善用錯誤停用的自動回復功能

毛石磊 Leslie

  • 恆逸教育訓練中心-資深講師
  • 技術分類:網路管理與通訊應用

 

 

區域網路的運作架構下,交換器扮演著相當重要的一個角色,除了可以順利的連接多台主機,進行資料的傳送外,網路管理人員也常會針對常見的一些網路威脅,在交換器上進行一些安全管控,例如:Port-Security、BPDU Guard、Dynamic ARP Inspection…等。

但在啟用這些安全控管機制後,當網路裡有違規行為發生時,交換器的作業系統為避免這些違規行為造成網路的危害,會主動將發生違規行為的介面,主動進行停用,此種機制稱作Error-disable。當介面一旦進入到Error-disabled的狀態,網路連線會馬上中斷,以下為Error-disabled狀態發生時的畫面訊息。

Error-disabled狀態發生時的畫面訊息

Port-security違規行為在Fa0/24介面被偵測到,介面進到Err-disable的狀態。

BPDU Guard違規行為在Gi0/1介面被偵測到,介面進到Err-disable的狀態。

當違規行為排除後,網路連線狀態會一直停留在Error-disabled的狀態,無法進行連線,需要由網路管理人員手動將介面關閉後再重新啟用,網路連線才會恢復,若善用錯誤停用的自動回復(Error-disable recovery)的功能,可減輕網路管理人員工作上的負擔。以下為Error-disable recovery功能的預設狀態(預設所有的安全控管機制都未啟用自動回復功能):

Switch# show errdisable recovery
ErrDisable Reason			      Timer Status
-----------------		             --------------
arp-inspection				        Disabled
bpduguard 				        Disabled
channel-misconfig (STP) 		        Disabled
dhcp-rate-limit		                        Disabled
dtp-flap					Disabled
gbic-invalid					Disabled
inline-power                                    Disabled
link-flap					Disabled
mac-limit					Disabled
loopback					Disabled
pagp-flap					Disabled
port-mode-failure				Disabled
pppoe-ia-rate-limit			        Disabled
psecure-violation				Disabled
security-violation				Disabled
sfp-config-mismatch			        Disabled
small-frame					Disabled
storm-control                                   Disabled
udld						Disabled
vmps						Disabled
psp						Disabled
Timer interval: 300 seconds

以下為Error-disable recovery功能的設定指令:

Switch# configure terminal
Switch(config)# errdisable recovery cause psecure-violation
Switch(config)# errdisable recovery cause bpduguard
Switch(config)# errdisable recovery interval 30

針對Port-security及BPDU Guard啟用Error-disable recovery自動回復功能,並設定自動回復的時間間隔值為30秒(預設為300秒),設定完成後可檢查相關設定。

Switch# show errdisable recovery
ErrDisable Reason                       Timer Status
-----------------                      --------------
arp-inspection                            Disabled
bpduguard                                 Enabled
channel-misconfig (STP)                   Disabled
dhcp-rate-limit                           Disabled
dtp-flap                                  Disabled
gbic-invalid                              Disabled
inline-power                              Disabled
link-flap                                 Disabled
mac-limit                                 Disabled
loopback                                  Disabled
pagp-flap                                 Disabled
port-mode-failure                         Disabled
pppoe-ia-rate-limit                       Disabled
psecure-violation                         Enabled
security-violation                        Disabled
sfp-config-mismatch                       Disabled
small-frame                               Disabled
storm-control                             Disabled
udld                                      Disabled
vmps                                      Disabled
psp                                       Disabled
Timer interval: 30 seconds

30秒的間隔時間一到,設備會嘗試回復Err-disable的介面:

Attempting to recover from psecure-violation err-disable state on Fa0/24
Interface FastEthernet0/24, changed state to up
Line protocol on Interface FastEthernet0/24, changed state to up
# Fa0/24的介面已無違規情形,介面自動恢復連線
Attempting to recover from bpduguard err-disable state on Gi0/1
Interface GigabitEthernet0/1, changed state to up
Line protocol on Interface GigabitEthernet0/1, changed state to up
Received BPDU on port Gi0/1 with BPDU Guard enabled. Disabling port.
bpduguard error detected on Gi0/1, putting Gi0/1 in err-disable state
Line protocol on Interface GigabitEthernet0/1, changed state to down
Interface GigabitEthernet0/1, changed state to down
# Gi0/1介面嘗試自動回復時,介面違規狀況並未排除,介面重新進入Err-disable的狀態