交換機端口假死(err-disable)解決方法

出現了這個問題,我們不得不重視起交換機端口“假死”的現象,尋求在交換機不重啓的狀態下將該端口“拯救”回來的方法。

拯救步驟1:查看日誌/端口的狀態

  登錄進入交換機後,執行show log,會看到如下的提示:
  21w6d: %ETHCNTR-3-LOOP_BACK_DETECTED: Keepalive packet loop-back detected on FastEthernet0/20.
  21w6d: %PM-4-ERR_DISABLE: loopback error detected on Fa0/20, putting Fa0/20 in err-disable state
  以上信息就明確表示由於檢測到第20端口出現了環路,所以將該端口置於了err-disable狀態。

   查看端口的狀態

  Switch# show inter fa0/20 status
  Port      Name           Status        Vlan   Duplex Speed Type
  Fa0/20    link to databackup err-disabled 562          auto   auto 10/100BaseTX
  這條信息更加明確的表示了該端口處於err-disabled狀態。
  既然看到了該端口是被置於了錯誤的狀態了,我們就應該有辦法將其再恢復成正常的狀態。
   拯救步驟2:將端口從錯誤狀態中恢復回來

  進入交換機全局配置模式,執行errdisable recovery cause ?,會看到如下信息:
  Switch(config)#errdisable recovery cause ?
   all                 Enable timer to recover from all causes
   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 detected 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
   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

  從列出的選項中,我們可以看出,有非常多的原因會引起端口被置於錯誤狀態,由於我們明確的知道這臺交換機上的端口是由於環路問題而被置於錯誤狀態的,所以就可以直接鍵入命令:

  Switch(config)#errdisable recovery cause loopback
  是啊,就這麼簡單的一條命令,就把困撓我們很長時間的問題解決了,真的就這麼神奇。那麼如何驗證這條命令是生效了呢?
   拯救步驟3:顯示被置於錯誤狀態端口的恢復情況

  Switch# show errdisable recovery
  ErrDisable Reason    Timer Status
  -----------------    --------------
  udld                 Disabled
  bpduguard            Disabled
  security-violatio    Disabled
  channel-misconfig    Disabled
  vmps                 Disabled
  pagp-flap            Disabled
  dtp-flap             Disabled
  link-flap            Disabled
  gbic-invalid         Disabled
  l2ptguard            Disabled
  psecure-violation    Disabled
  gbic-invalid         Disabled
  dhcp-rate-limit      Disabled
  unicast-flood        Disabled
  loopback             Enabled
  Timer interval: 300 seconds
  Interfaces that will be enabled at the next timeout:
  Interface    Errdisable reason    Time left(sec)
  ---------    -----------------    --------------
  Fa0/8              loopback              276
  Fa0/17             loopback              267
  Fa0/20             loopback              250

  從以上顯示的信息可以看出,這臺交換機有三個端口(Fa0/8、Fa0/17、Fa0/20)會分別在276、267、250秒之後恢復爲正常的狀態,實際情況也是這樣,等了幾分鐘以後,我們找了一臺筆記本電腦,分別接到這幾個端口上試了一下,端口都可以正常工作了。這下總算在不重交換機的情況下,將幾個處於“假死”狀態的端口“拯救”了回來。
關於接口處於err-disable的故障排查
故障症狀:
線路不通,物理指示燈滅或者顯示爲橙色(不同平臺指示燈狀態不同)
show interface輸出顯示接口狀態:
FastEthernet0/47 is down, line protocol is down (err-disabled)
接口狀態是err-disable。

sw1#show interfaces status

Port Name Status Vlan Duplex Speed Type
Fa0/47 err-disabled 1 auto auto 10/100BaseTX

如果出現了接口狀態爲err-disable,show interfaces status err-disabled命令能查看觸發err-disable的原因。
下面示例原因爲bpduguard,在連接了交換機的端口配置了spanning-tree bpduguard enable。

sw1#show interfaces status err-disabled
Port Name Status Reason
Fa0/47 err-disabled bpduguard
接口產生err-disable的原因可以由以下的命令來查看,系統缺省的配置是所有列出的原因都能導致接口被置爲err-disable。

sw1#show errdisable detect
ErrDisable Reason Detection status
----------------- ----------------
udld Enabled
bpduguard Enabled
security-violatio Enabled
channel-misconfig Enabled
psecure-violation Enabled
dhcp-rate-limit Enabled
unicast-flood Enabled
vmps Enabled
pagp-flap Enabled
dtp-flap Enabled
link-flap Enabled
l2ptguard Enabled
gbic-invalid Enabled
loopback Enabled
dhcp-rate-limit Enabled
unicast-flood Enabled
從列表中,我們可以看出常見的原因有udld,bpduguard,link-flap以及loopback等。
具體由什麼原因導致當前接口err-disable可以由show interface status err-disable來查看。

在接口模式下采用shutdown,no shutdown進行手動的激活。
在缺省配置下,一旦接口被置爲err-disable,IOS將不會試圖恢復接口。
這個可以由show errdisable recovery來查看,timer status下面所有的值都是disable。
下面的示例中,由於手工配置了bpduguard恢復,所以timer status的值變爲Enable。

sw1#show errdisable recovery
ErrDisable Reason Timer Status
----------------- --------------
udld Disabled
bpduguard Enabled
security-violatio Disabled
channel-misconfig Disabled
vmps Disabled
pagp-flap Disabled
dtp-flap Disabled
link-flap Disabled
l2ptguard Disabled
psecure-violation Disabled
gbic-invalid Disabled
dhcp-rate-limit Disabled
unicast-flood Disabled
loopback Disabled
Timer interval: 300 seconds
Interfaces that will be enabled at the next timeout:
Interface Errdisable reason Time left(sec)
--------- ----------------- --------------
Fa0/47 bpduguard 217
配置IOS重新激活errdisable的接口,使用以下命令:

sw1(config)#errdisable recovery cause bpduguard
sw1(config)#errdisable recovery cause ?
all Enable timer to recover from all causes
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 detected 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
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

配置完上述命令後,IOS在一段時間後試圖恢復被置爲err-disable的接口,這段時間缺省爲300秒。
但是,如果引起err-disable的源沒有根治,在恢復工作後,接口會再次被置爲err-disable。
調整err-disable的超時時間,可以使用以下命令:

sw1(config)#errdisable recovery interval ?
<30-86400> timer-interval(sec)
可以調整在30-86400秒,缺省是300秒。
如果產生err-disable的原因是udld,下面有一條命令非常管用:

sw1#udld reset

No ports are disabled by UDLD.
同時,接口在被置爲err-disable的時候,通常有一系列的日誌產生,如下:
*Mar 15 15:47:19.984: %SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port FastEthernet0/47 with BPDU Guard enabled. Disabling port.
sw1#
*Mar 15 15:47:19.984: %PM-4-ERR_DISABLE: bpduguard error detected on Fa0/47, putting Fa0/47 in err-disable state
sw1#
*Mar 15 15:47:21.996: %LINK-3-UPDOWN: Interface FastEthernet0/47, changed state to down
收集這些日誌也非常管用。
所以建議配置一個syslog server,收集log信息。
故障症狀:
線路不通,物理指示燈滅或者顯示爲橙色(不同平臺指示燈狀態不同)
show interface 輸出顯示接口狀態:
FastEthernet0/47 is down, line protocol is down (err-disabled)
接口狀態是err-disable。
sw1#show interfaces status
Port Name Status Vlan Duplex Speed Type
Fa0/47 err-disabled 1 auto auto 10/100BaseTX
如果出現了接口狀態爲err-disable,show interfaces status err-disabled命令能查看觸發err-disable的原因。
下面示例原因爲bpduguard,在連接了交換機的端口配置了spanning-tree bpduguard enable。
sw1#show interfaces status err-disabled[b]
Port Name [b]Status Reason
Fa0/47 err-disabled [b]bpduguard[b]
接口產生err-disable的原因可以由以下的命令來查看,系統缺省的配置是所有列出的原因都能導致接口被置爲err-disable。
sw1#show errdisable detect
ErrDisable Reason Detection status
----------------- ----------------
udld Enabled
bpduguard Enabled
security-violatio Enabled
channel-misconfig Enabled
psecure-violation Enabled
dhcp-rate-limit Enabled
unicast-flood Enabled
vmps Enabled
pagp-flap Enabled
dtp-flap Enabled
link-flap Enabled
l2ptguard Enabled
gbic-invalid Enabled
loopback Enabled
dhcp-rate-limit Enabled
unicast-flood Enabled
從列表中,我們可以看出常見的原因有udld,bpduguard,link-flap以及loopback等。
具體由什麼原因導致當前接口err-disable可以由show interface status err-disable來查看。
在接口模式下采用shutdown,no shutdown進行手動的激活。
在缺省配置下,一旦接口被置爲err-disable,IOS將不會試圖恢復接口。
這個可以由show errdisable recovery來查看,timer status下面所有的值都是disable。
下面的示例中,由於手工配置了bpduguard恢復,所以timer status的值變爲Enable。
sw1#show errdisable recovery
ErrDisable Reason Timer Status
----------------- --------------
udld Disabled
bpduguard Enabled
security-violatio Disabled
channel-misconfig Disabled
vmps Disabled
pagp-flap Disabled
dtp-flap Disabled
link-flap Disabled
l2ptguard Disabled
psecure-violation Disabled
gbic-invalid Disabled
dhcp-rate-limit Disabled
unicast-flood Disabled
loopback Disabled
Timer interval: 300 seconds
Interfaces that will be enabled at the next timeout:
Interface Errdisable reason Time left(sec)
--------- ----------------- --------------
Fa0/47 bpduguard 217
配置IOS重新激活errdisable的接口,使用以下命令:
sw1(config)#errdisable recovery cause bpduguard
sw1(config)#errdisable recovery cause ?
all Enable timer to recover from all causes
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 detected 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
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
配置完上述命令後,IOS在一段時間後試圖恢復被置爲err-disable的接口,這段時間缺省爲300秒。
但是,如果引起err-disable的源沒有根治,在恢復工作後,接口會再次被置爲err-disable。
調整err-disable的超時時間,可以使用以下命令:
sw1(config)#errdisable recovery interval ?
<30-86400> timer-interval(sec)
可以調整在30-86400秒,缺省是300秒。
如果產生err-disable的原因是udld,下面有一條命令非常管用:
sw1#udld reset
No ports are disabled by UDLD.
同時,接口在被置爲err-disable的時候,通常有一系列的日誌產生,如下:
*Mar 15 15:47:19.984: %SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port FastEthernet0/47 with BPDU Guard enabled. Disabling port.
sw1#
*Mar 15 15:47:19.984: %PM-4-ERR_DISABLE: bpduguard error detected on Fa0/47, putting Fa0/47 in err-disable state
sw1#
*Mar 15 15:47:21.996: %LINK-3-UPDOWN: Interface FastEthernet0/47, changed state to down
收集這些日誌也非常管用。
所以建議配置一個syslog server,收集log信息。
sw1#show interfaces status Port Name Status Vlan Du... 開啓errdisable功能,這樣可以使用show errdisable來查看引發errdisable的原因是什麼,再更加信息內容進行解決。
你要是想不影響使用的話,先用 no errdisable detect cause loopback 執行一下,將已經死掉的端口,no sh 一下 如果沒問題,肯定是環路了,你可再找時間,對懷疑有問題的switch用拔插法,一個一個拔掉網線去查,當然,有更有效的方法,你可查看有問題的switch的所有rj45和gi口的狀態,哪個有errdisable信息哪個就有問題。
switch#show interfaces status err-disabled
Port Name Status Reason
Fa0/22 err-disabled link-flap
Fa0/37 For office in 100K err-disabled link-flap
Fa0/41 unknow err-disabled link-flap
Fa0/42 Training Dc066 err-disabled link-flap
Fa0/45 Production line VM err-disabled link-flap
switch#show errdisable detect
ErrDisable Reason Detection status
----------------- ----------------
pagp-flap Enabled dtp-flap Enabled link-flap Enabled l2ptguard Enabled gbic-invalid Enabled loopback Enabled
switch#show interfaces status err-disabled
Port Name Status Reason
Fa0/22 err-disabled link-flap
Fa0/37 For office in 100K err-disabled link-flap
Fa0/41 unknow err-disabled link-flap
Fa0/42 Training Dc066 err-disabled link-flap
Fa0/45 Production line VM err-disabled link-flap
switch#sh errdisable flap-values
ErrDisable Reason Flaps Time (sec) ----------------- ------ ----------
pagp-flap 3 30 dtp-flap 3 30 link-flap 5 10 ( link-flap 這就是因爲鏈路質量不好導致的) 關閉errdisable detectswitch#no errdisable detect cause all
導致交換機接口出現err-disable的幾個常見原因:  
   1. EtherChannel misconfiguration
   2. Duplex mismatch
   style="TEXT-INDENT: 2em">3. BPDU port guard
   4. UDLD
   5. Link-flap error
   6. Loopback error
   7. Port security violation
   第一個當F EC兩端配置不匹配的時候就會出現err-disable.假設Switch A把FEC模式配置爲on,這時Switch A是不會發送PAgP包和相連的Switch B去協商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和BPDU guard有關。如果一個接口配置了portfast,那也就是說這個接口應該和一個pc連接,pc是不會發送spanning-tree的BPDU幀的,因此這個口也接收BPDU來生成spanning-tree,管理員也是出於好心在同一接口上配置了BPDU guard來防止未知的BPDU幀以增強安全性,但他恰恰不小心把一個交換機接到這個同時配置了portfast和BPDU guard接口上,於是這個接口接到了BPDU幀,因爲配置了BPDU guard,這個接口自然要進入到err-disable狀態。解決辦法:no spanning-tree portfast bpduguard default,或者直接把portfast關了。
   第四個原因是UDLD.UDLD是cisco的私有2層協議,用於檢測鏈路的單向問題。有的時候物理層是up的,但鏈路層就是down,這時候就需要UDLD去檢測鏈路是否是真的up的。當AB兩端都配置好UDLD後,A給B發送一個包含自己port id的UDLD幀,B收到後會返回一個UDLD幀,並在其中包含了收到的A的port id,當A接收到這個幀並發現自己的port id也在其中後,認爲這鏈路是好的。反之就變成err-disable狀態了。假設A配置了UDLD,而B沒有配置UDLD:A給B發送一個包含自己port id的幀,B收到後並不知道這個幀是什麼,也就不會返回一個包含A的port id的UDLD幀,那麼這時候A就認爲這條鏈路是一個單向鏈路,自然也就變成err-disable狀態了。
   第五個原因就是鏈路的抖動,當鏈路在10秒內反覆up、down五次,那麼就進入err-disable狀態。
   第六個原因就是keepalive loopback.在12.1EA之前,默認情況下交換機會在所有接口都發送keepalive信息,由於一些不通交換機協商spanning-tree可能會有問題,一個接口又收到了自己發出的keepalive,那麼這個接口就會變成err-disable了。解決辦法就是把keepalive關了。或者把ios升到12.2SE.
   最後一個原因,相對簡單,就是由於配置了port-security violation shutdown


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