當路由協議數據包、管理數據包、keepaive等信息進入路由器時需要RP(Route Processor)來處理,或者說目的地址是路由器本身時,也需要由RP來處理。當有針對路由器自身的dos攻擊時,如果所有信息都有RP處理,很容易導致路由器癱瘓。此時可通過設置selective packet discard來丟棄一些惡意的數據包,來保證設備的穩定運行。 * SPD默認是enable的 ;* SPD最初只是為pos口設計的,但后來GE口也可以使用spd技術 * 7200 Series Router * 7500 Series Router * 12000 Series Router SPD可通過2種方式丟棄數據包: * SPD State Check * Input Queue 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掉 * 如果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)處理 SPD state check是基于RP的,而Input Queue Check是基于interface的。如果不開啟spd的話,默認情況下每個interface的queue是75,當queue中的數據大于75時,大于75的部分會被丟棄。這個queue可以通過show interface看到。 GigabitEthernet1/2 is up, line protocol is up Hardware is GigMac 3 Port GigabitEthernet, address is 0005.5ffd.4082 (bia 0005.5ffd.4082) Description: sample Internet address is x.x.x.x/30 MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, rely 255/255, load 131/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full Duplex, 1000Mbps, link type is force-up, media type is LX output flow-control is unsupported, input flow-control is unsupported ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:00, output 00:00:03, output hang never Last clearing of "show interface" counters never Queueing strategy: fifo Output queue 0/40, 0 drops; input queue 0/75, 25 drops //[就在這里] 30 second input rate 613917000 bits/sec, 122041 packets/sec 30 second output rate 517166000 bits/sec, 123695 packets/sec 77400124545 packets input, 44369025705444 bytes, 0 no buffer Received 5898 broadcasts, 0 runts, 0 giants, 0 throttles 647964 input errors, 0 CRC, 0 frame, 485923 overrun, 162041 ignored 0 watchdog, 0 multicast, 0 pause input 69912443364 packets output, 41951561990047 bytes, 0 underruns Transmitted 1 broadcasts 0 output errors, 0 collisions, 0 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier, 0 pause output 0 output buffer failures, 0 output buffers swapped out 如果需要修改這個queue的長度,可通過以下命令修改 O-HPM-GSR-1(config-if)#hold-queue ? <0-4096> Queue length O-HPM-GSR-1(config-if)#hold-queue 100 ? in Input queue out Output queue O-HPM-GSR-1(config-if)#hold-queue 100 in O-HPM-GSR-1(config-if)#hold-queue 100 in ? O-HPM-GSR-1(config-if)#hold-queue 100 in 如果開啟了SPD,那么priority為7和6的數據包會進入process level input queue(這個queue的名字叫headroom),而其他的數據包仍然會放在interface input queue里。process level input queue的大小默認為100.也就是說當interface總的queue長度175被用滿后,priority是7和6的數據包就會被丟棄了。對于 GSR來說,這個process level input queue的長度默認是1000,這是由于clear ip bgp時會有很多packet進來,如果還是100的話,很多bgp包會被丟棄,這樣就會影響網絡收斂的速度。 由于ospf、isis、ppp、clns這類igp和2層鏈路間的keepalive的priority和bgp一樣,如果在一個很大的bgp網絡中, bgp的packet會比igp的多的多,那么他會大量的占據headroom,這就有可能導致igp的中斷、或者直接在layer 2鏈路down掉。因此對于這樣的數據包,默認再分配一個值為10的extended headroom,來保證igp和layer2 link的正常工作。 O-HPM-GSR-1#sho ip spd Current mode: normal. Queue min/max thresholds: 73/74, Headroom: 1000, Extended Headroom: 10 IP normal queue: 0, priority queue: 0. SPD special drop mode: none
新聞熱點
疑難解答