inter 千M网卡驱动安装和启用vlan.Polling抗拒绝服务
<p>建立一个文件夹把驱动复制到里面 <br />#mkdir /usr/local/src/em <br />
解压缩 <br />
#tar xvfz em-5.1.5.tar.gz <br />
#cd em-5.1.5 <br />
编译模块 <br />
# make <br />
<a target="_blank" href="#" class="UBBWordLink">安装</a>编译好的模块 <br />
#make install <br />
如果你想启动的时候自动加载模块修改 <br />
ee /boot/loader.conf <br />
添加if_em_load="YES" <br />
------------------------------------------------------ <br />
编译驱动到内核 <br />
cd /usr/local/src/em/em-5.1.5/src <br />
cp if_em* /usr/src/sys/dev/em <br />
cp Makefile.kernel /usr/src/sys/modules/em/Makefile <br />
修改/usr/src/sys/conf/files.i386 文件添加以下两行到文件 <br />
内</p>
<p>dev/em/if_em.c optional em <br />
dev/em/if_em_hw.c optional em <br />
修改你的内核配置文件。确定有 <br />
device em</p>
<p>编译<a target="_blank" href="#" class="UBBWordLink">安装</a>内核。。。reboot.完成</p>
<p>----------------------------------------------------------- <br />
下面说下有关网卡<a target="_blank" href="#" class="UBBWordLink">设置</a>的参数 <br />
ifconfig_em<interface_num>="<ifconfig_settings>" <br />
ifconfig em<interface_num> <IP_address> media 100baseTX mediaopt full-duplex <br />
驱动所支持的模式:</p>
<p> autoselect - Enables auto-negotiation for speed and duplex.</p>
<p> 10baseT/UTP - Sets speed to 10 Mbps. Use the ifconfig mediaopt <br />
option to select full-duplex mode.</p>
<p> 100baseTX - Sets speed to 100 Mbps. Use the ifconfig mediaopt <br />
option to select full-duplex mode.</p>
<p> 1000baseTX - Sets speed to 1000 Mbps. In this case, the driver <br />
supports only full-duplex mode.</p>
<p> 1000baseSX - Sets speed to 1000 Mbps. In this case, the driver <br />
supports only full-duplex mode.</p>
<p>ifconfig em<interface_num> <hostname or IP address> mtu 9000 <br />
route get <destination_IP_address></p>
<p>VLANS设置建立vlan <br />
#ifconfig <vlan_name> create <br />
网卡的配置: <br />
ifconfig <vlan_name> <ip_address> netmask <subnet_mask> vlan <vlan_id> vlandev </p>
<p><physical_interface> <br />
例如: <br />
ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan10 vlandev em0 <br />
删除VLAN <br />
#ifconfig <vlan_name> destroy</p>
<p>Polling模式:本来网卡工作模式:需要的时候请求中断。但在拒绝<a target="_blank" href="#" class="UBBWordLink">服务</a>攻击情况下,包数太多,就不太</p>
<p>可行,polling模式就是让cpu定期去取网卡内存中的数据包。虽然平时看上去这种<a target="_blank" href="#" class="UBBWordLink">方法</a>比较效率低,但在</p>
<p>拒绝<a target="_blank" href="#" class="UBBWordLink">服务</a>攻击情况下就比较好用。 <br />
在内核中确保: <br />
options DEVICE_POLLING <br />
可选: <br />
options HZ=1000 <br />
polling在sysctl中参数的含义 <br />
kern.polling.enable=1 打开polling模式 <br />
kern.polling.burst 每个时间片,<a target="_blank" href="#" class="UBBWordLink">系统</a>在每个网卡可以抓的最多的包值,不可以改的值,根据其</p>
<p>他值<a target="_blank" href="#" class="UBBWordLink">系统</a>自己算的 <br />
kern.polling.burst_max 每次取多少内存中的包默认150,是 一个参数,和内核里面的HZ相乘(HZ * </p>
<p>burst_max)就是每秒cpu极限可以抓的包量 默认HZ=1000 <br />
kern.polling.each_burst 没搞懂用处,默认5 好像用处不大 <br />
kern.polling.idle_poll=1 man 中推荐打开选项 <br />
kern.polling.reg_frac 多久检测一次网卡错误 默认20 <br />
kern.polling.user_frac=10 cpu预留给userland tasks的量 默认50, 做防火墙推荐少留一点 <br />
kern.polling.handlers 有多少网卡注册了polling服务 不用改</p>
<p>注:HZ的含义以及burst_max的关系,HZ就是赫兹,时间的倒数,就是多久cpu去取一次网卡内存中的包 <br />
HZ越大,CPU去取的时间间隔越短,burst_max就是每次取多少内存中的包。 <br />
这个参数需要自行测试,HZ越大,在大流量下用top看中断就越多 <br />
感觉范围在500-2000比较合适,再大就。。。。。 <br />
在内核中为:options HZ=500 (我<a target="_blank" href="#" class="UBBWordLink">设置</a>500,burst_max设置150,可保证我的<a target="_blank" href="#" class="UBBWordLink">服务</a>器稳定和抗攻击能力比较好)<br />
</p>
頁:
[1]