Cisco 端口策略檢測

CISCO交換機默認是起用錯誤檢測的,檢測到任何錯誤時,關閉端口。默認的檢測類型是全部都檢測,具體可以檢測的類型有下面的幾種:

RT4(config)#errdisable detect cause

all Enable error detection on all cases
arp-inspection Enable error detection for arp inspection
dhcp-rate-limit Enable error detection on dhcp-rate-limit
dtp-flap Enable error detection on dtp-flapping
gbic-invalid Enable error detection on gbic-invalid
l2ptguard Enable error detection on l2protocol-tunnel
link-flap Enable error detection on linkstate-flapping
loopback Enable error detection on loopback
pagp-flap Enable error detection on pagp-flapping

自動檢測非常煩,遇到錯誤就會自動把端口關閉。如果不想啓動錯誤檢測,可以用命令no errdisable detect cause all來關閉。

如果想檢測一部分內容,不想檢測另一部分,可以用下面的命令來關閉其中的檢測項目

RT4(config)#no errdisable detect cause ?
all Enable error detection on all cases
arp-inspection Enable error detection for arp inspection
dhcp-rate-limit Enable error detection on dhcp-rate-limit
dtp-flap Enable error detection on dtp-flapping
gbic-invalid Enable error detection on gbic-invalid
l2ptguard Enable error detection on l2protocol-tunnel
link-flap Enable error detection on linkstate-flapping
loopback Enable error detection on loopback
pagp-flap Enable error detection on pagp-flapping

CISCO還提供了自動恢復機制。默認自動恢復機制不啓動,即關閉了端口不會打開。如果想讓交換機關閉了端口一段時間後自動打開,可以用下面的命令來設置各具體項。all參數表示所有的類型都可以關閉一段時間後,自動打開。

RT4(config)#errdisable recovery cause ?
all Enable timer to recover from all causes
arp-inspection Enable timer to recover from arp inspection error disable
state
bpduguard Enable timer to recover from BPDU Guard error disable
state
channel-misconfig Enable timer to recover from channel misconfig disable
state
dhcp-rate-limit Enable timer to recover from dhcp-rate-limit error
disable state
dtp-flap Enable timer to recover from dtp-flap error disable state
gbic-invalid Enable timer to recover from invalid GBIC error disable
state
l2ptguard Enable timer to recover from l2protocol-tunnel error
disable state
link-flap Enable timer to recover from link-flap error disable
state
loopback Enable timer to recover from loopback disable state
pagp-flap Enable timer to recover from pagp-flap error disable
state
psecure-violation Enable timer to recover from psecure violation disable
state
security-violation Enable timer to recover from 802.1x violation disable
state
storm-control Enable timer to recover from storm-control error disable
state
udld Enable timer to recover from udld error disable state
unicast-flood Enable timer to recover from unicast flood disable state
vmps Enable timer to recover from vmps shutdown error disable
state

默認的關閉時間是30秒,時間過後自動打開。可以通過命令RT4(config)#errdisable recovery interval<30-86400> timer-interval(sec)
來調整這個時間。

大家在調試中注意,判斷時,可以通過命令sh interface 看,會有“err-disable”的字樣。

導致交換機接口出現err-disable的幾個常見原因:

引用

1.EtherChannelmisconfiguration

2.Duplexmismatch

3.BPDUportguard

4.UDLD

5.Link-flaperror

6.Loopbackerror

7.Portsecurityviolation

第一個當FEC兩端配置不匹配的時候就會出現err-disable。

假設SwitchA把FEC模式配置爲on,這時SwitchA是不會發送PAgP包和相連的SwitchB去協商FEC的,它假設Switch  B已經配置好FEC了。但實事上Swtich B並沒有配置FEC,當Switch B的這個狀態超過1分鐘後,Switch  A的STP就認爲有環路出現,因此也就出現了err-disable。解決辦法就是把FEC的模式配置爲channel-group 1 mode  desirable non-silent這個意思是隻有當雙方的FEC協商成功後才建立channel,否則接口還處於正常狀態。

第二個原因就是雙工不匹配。一端配置爲half-duplex後,他會檢測對端是否在傳輸數據,只有對端停止傳輸數據,他纔會發送類似於ack的包 來讓鏈路  up,但對端卻配置成了full-duplex,他纔不管鏈路是否是空閒的,他只會不停的發送讓鏈路up的請求,這樣下去,鏈路狀態就變成err-  disable了。

三、第三個原因BPDU,也就是和portfast和BPDUguard有關。如果一個接口配置了portfast,那也就是說這個接口應該和一個 pc連接,pc是不會發送spanning-tree的BPDU幀的,因此這個口也接收BPDU來生成spanning-  tree,管理員也是出於好心在同一接口上配置了BPDUguard來防止未知的BPDU幀以增強安全性,但他恰恰不小心把一個交換機接到這個同時配置了  portfast和BPDUguard 接口上,於是這個接口接到了BPDU幀,因爲配置了BPDU  guard,這個接口自然要進入到err-disable狀態。解決辦法:no spanning-tree portfast bpduguard  default,或者直接把portfast關了。

第四個原因是UDLD。UDLD是cisco的私有2層協議,用於檢測鏈路的單向問題。有的時候物理層是up的,但鏈路層就是down,這時候就需 要  UDLD去檢測鏈路是否是真的up的。當AB兩端都配置好UDLD後,A給B發送一個包含自己portid的UDLD幀,B收到後會返回一個UDLD幀, 並在其中包含了收到的A的portid,當A接收到這個幀並發現自己的portid也在其中後,認爲這鏈路是好的。反之就變成err-disable狀態 了。假設A配置了UDLD,而B沒有配置UDLD:A給B發送一個包含自己port  id的幀,B收到後並不知道這個幀是什麼,也就不會返回一個包含A的port  id的UDLD幀,那麼這時候A就認爲這條鏈路是一個單向鏈路,自然也就變成err-disable狀態了。

第五個原因就是鏈路的抖動,當鏈路在10秒內反覆up、down五次,那麼就進入err-disable狀態。

第六個原因就是keepaliveloopback。在12.1EA之前,默認情況下交換機會在所有接口都發送keepalive信息,由於一些不 通交換機協商spanning-tree可能會有問題,一個接口又收到了自己發出的keepalive,那麼這個接口就會變成err-disable了。 解決辦法就是把keepalive關了。或者把ios升到12.2SE。

最後一個原因,相對簡單,就是由於配置了port-securityviolationshutdown。這個太簡單,就不解釋啦。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章