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

Unix/Linux
查看linux 下已经安装的软件包信息
linux 系统中软件raid 配置方法
linux 下MySQL服务器的启动与停止
linux 系统下FTP服务器配置方法
Linux系统下如何挂载U盘,硬盘,光驱
linux 系统下DHCP服务器 配置方法
Linux系统下软件的安装与卸载
在Fedora 9中启用ext4文件系统的方法
linux下挂载(mount)光盘镜像文件、移动硬盘、U盘、Windows网络共享和NFS网络共享
Linux查看文件夹大小的命令
LINUX系统grub常见错误分析
llinux fdisk分区工具 使用方法
linux 系统telnet乱码
rhythmbox 乱码的解决方法
linux单网卡绑定多ip
tar.gz 和tar.bz2 详细解释
linux学习笔记
linux系统rpm安装包详解
linux 服务器常用维护命令
出现The file /boot/grub/stage1 not read cor 解决办法

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-15   浏览: 276 ::
收藏到网摘: 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,可保证我的服务器稳定和抗攻击能力比较好)