当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > inter 千M网卡驱动安装和启用vlan.Polling抗拒绝服务

Unix/Linux
Linux中NE2000兼容网卡的安装
sis650显卡驱动自定义安装终极指南(RH80)
配置好显卡驱动Linux下玩游戏同样爽
linux设备驱动笔记:字符设备驱动
把设备驱动程序编译进嵌入式Linux内核
删除Linux引导界面的方法及注意事项
在Linux操作系统下如何开启硬盘DMA
从Linux BIOS的起源 看未来主板框架
深入浅出 Linux字符设备驱动程序解析
Linux系统启动引导程序配置文件解析
深入浅出 Linux设备驱动异步通知介绍
深入浅出 Linux设备驱动中断处理介绍
新手看招 Linux操作系统的目录结构一览
菜鸟乐园 Linux中常见文件系统格式介绍
Motorola微处理器bootloader分析与应用
实用技巧 Linux系统的经典使用技巧八则
Linux操作系统下IPTables配置方法详解
Linux系统中增加Swap分区文件步骤方法
使用Openssh工具远程管理Solaris 10
uClinux中添加用户应用程序的详细方法

Unix/Linux 中的 inter 千M网卡驱动安装和启用vlan.Polling抗拒绝服务


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-15   浏览: 256 ::
收藏到网摘: n/a

建立一个文件夹把驱动复制到里面
#mkdir /usr/local/src/em
解压缩
#tar xvfz em-5.1.5.tar.gz
#cd em-5.1.5
编译模块
# make
安装编译好的模块
#make install
如果你想启动的时候自动加载模块修改
ee /boot/loader.conf
添加if_em_load="YES"
------------------------------------------------------
编译驱动到内核
cd /usr/local/src/em/em-5.1.5/src
cp if_em* /usr/src/sys/dev/em
cp Makefile.kernel /usr/src/sys/modules/em/Makefile
修改/usr/src/sys/conf/files.i386 文件添加以下两行到文件

dev/em/if_em.c optional em 
dev/em/if_em_hw.c optional em 
修改你的内核配置文件。确定有
device em

-----------------------------------------------------------
下面说下有关网卡设置的参数
ifconfig_em<interface_num>="<ifconfig_settings>"
ifconfig em<interface_num> <IP_address> media 100baseTX mediaopt  full-duplex
驱动所支持的模式:

   autoselect      -  Enables auto-negotiation for speed and duplex.

   10baseT/UTP     -  Sets speed to 10 Mbps. Use the ifconfig mediaopt 
                      option to select full-duplex mode.

   100baseTX       -  Sets speed to 100 Mbps. Use the ifconfig mediaopt
                      option to select full-duplex mode.

   1000baseTX      -  Sets speed to 1000 Mbps. In this case, the driver
                      supports only full-duplex mode.

   1000baseSX      -  Sets speed to 1000 Mbps. In this case, the driver
                      supports only full-duplex mode.

ifconfig em<interface_num> <hostname or IP address> mtu 9000
route get <destination_IP_address>

[color=Red]VLANS设置[/color]建立vlan
#ifconfig <vlan_name> create
网卡的配置:
ifconfig <vlan_name> <ip_address> netmask <subnet_mask> vlan  <vlan_id> vlandev 

<physical_interface>
例如:
ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan10 vlandev em0
删除VLAN
#ifconfig <vlan_name> destroy

[color=Red]Polling模式:本来网卡工作模式:需要的时候请求中断。但在拒绝服务攻击情况下,包数太多,就不太

可行,polling模式就是让cpu定期去取网卡内存中的数据包。虽然平时看上去这种方法比较效率低,但在

拒绝服务攻击情况下就比较好用。[/color]
在内核中确保:
options DEVICE_POLLING
可选:
options HZ=1000
polling在sysctl中参数的含义
kern.polling.enable=1           打开polling模式
kern.polling.burst                  每个时间片,系统在每个网卡可以抓的最多的包值,不可以改的值,根据其

他值系统自己算的
kern.polling.burst_max          每次取多少内存中的包默认150,是 一个参数,和内核里面的HZ相乘(HZ * 

burst_max)就是每秒cpu极限可以抓的包量   默认HZ=1000
kern.polling.each_burst         没搞懂用处,默认5 好像用处不大
kern.polling.idle_poll=1          man 中推荐打开选项
kern.polling.reg_frac             多久检测一次网卡错误 默认20
kern.polling.user_frac=10      cpu预留给userland  tasks的量 默认50, 做防火墙推荐少留一点
kern.polling.handlers              有多少网卡注册了polling服务  不用改

注:HZ的含义以及burst_max的关系,HZ就是赫兹,时间的倒数,就是多久cpu去取一次网卡内存中的包
HZ越大,CPU去取的时间间隔越短,burst_max就是每次取多少内存中的包。
这个参数需要自行测试,HZ越大,在大流量下用top看中断就越多
感觉范围在500-2000比较合适,再大就。。。。。
在内核中为:options HZ=500   (我设置500,burst_max设置150,可保证我的服务器稳定和抗攻击能力比较好)