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

Unix/Linux
Linux 备份 恢复方法
Linux玩CS反恐精英的方法
在一个ISO镜像中集成多个不同的linux发行版,可刻盘,可引导
Linux 快捷键使用
Linux DHCP 服务器配置方法介绍
Linux 22端口的修改方法
Linux 记录会话过程的命令
Linux 后台执行程序如何操作?
linux Wget命令来浏览网页的方法
Linux tail命令的巧妙应用
Wine 中文存在很多的乱码怎么解决方法
linux 新手教程之创建锁文件的方法
配置Linux 保证其系统的安全
Linux DHCP协议实现过程
Linux系统下破解SAM密码
linux/unix vi 编辑器用法详解
Linux 误删文件的解决方法
Linux系统下的历史记录删除方法
Red Hat Linux 安全设置指南
Linux基本命令-注销、关机、重启

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


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