教你将路由器设置为可选择性数据包丢弃_路由技术
当路由协议数据包、治理数据包、keepaive等信息进入路由器时需要RP(Route Processor)来处理,或者说目的地址是路由器本身时,也需要由RP来处理。当有针对路由器自身的dos攻击时,假如所有信息都有RP处理,很轻易导致路由器瘫痪。此时可通过设置selective packet discard来丢弃一些恶意的数据包,来保证设备的稳定运行。* SPD默认是enable的 ;* SPD最初只是为pos口设计的,但后来GE口也可以使用spd技术===== 支持SPD的设备 =====* 7200 Series Router* 7500 Series Router* 12000 Series Router===== SPD原理 =====SPD可通过2种方式丢弃数据包:* SPD State Check* Input Queue Check==== SPD State Check ====所有到RP的数据包可分为2类:* 假如进入priority queue的,并且priority为7和6的,永远都不会被drop掉* 其他数据包被放入general packet queue,并进行spd state check 对于进入general packet queue的数据包,也就是进行spd state check的数据包会进行如下处理: * 假如queue的长度小于min-threshold,正常包和畸形包都不会被drop掉 * 假如queue的长度在min-threshold和max-threshold之间 * 假如是normal mode,正常包和畸形包会被随机的丢弃 * 假如是aggresive mode,所有畸形包会被丢弃 * 假如queue的长度大于max-threshold,那么所有正常包和畸形包都会被drop掉=== aggressive mode === * 假如spd工作在aggressive mode,所有的畸形包会被丢弃,例如invalid checksum、incorrect version、incorrect header length、incorrect packet length等。 * 通过命令ip spd mode aggressive开启aggressive mode * 12000系列路由器不支持aggressive mode,由于畸形包在会被每个linecard丢弃,而不需要由GRP(gigabit route processor)处理 ==== Input Queue Check ==== === input queue === SPD state check是基于RP的,而Input Queue Check是基于inte***ce的。假如不开启spd的话,默认情况下每个inte***ce的queue是75,当queue中的数据大于75时,大于75的部分会被丢弃。这个queue可以通过show inte***ce看到。GigabitEthernet1/2 is up, line protocol is up Hardware is GigMac 3 Port GigabitEthernet, address is 0005.5ffd.4082 (bia 0005.5ffd.4082)Description: sampleInternet address is x.x.x.x/30MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, rely 255/255, load 131/255Encapsulation ARPA, loopback not setKeepalive set (10 sec)Full Duplex, 1000Mbps, link type is force-up, media type is LXoutput flow-control is unsupported, input flow-control is unsupportedARP type: ARPA, ARP Timeout 04:00:00Last input 00:00:00, output 00:00:03, output hang neverLast clearing of "show inte***ce" counters neverQueueing strategy: fifoOutput queue 0/40, 0 drops; input queue 0/75, 25 drops //[就在这里]30 second input rate 613917000 bits/sec, 122041 packets/sec30 second output rate 517166000 bits/sec, 123695 packets/sec77400124545 packets input, 44369025705444 bytes, 0 no bufferReceived 5898 broadcasts, 0 runts, 0 giants, 0 throttles647964 input errors, 0 CRC, 0 frame, 485923 overrun, 162041 ignored0 watchdog, 0 multicast, 0 pause input69912443364 packets output, 41951561990047 bytes, 0 underrunsTransmitted 1 broadcasts0 output errors, 0 collisions, 0 inte***ce resets0 babbles, 0 late collision, 0 deferred0 lost carrier, 0 no carrier, 0 pause output0 output buffer failures, 0 output buffers swapped out假如需要修改这个queue的长度,可通过以下命令修改 1/2 12下一页尾页
页:
[1]