一、err-disabled状态概述
(一)什么是err-disabled状态
err-disabled是端口的一种保护状态,当端口检测到特定错误条件时,自动进入此状态。端口停止转发流量,需要手动或自动恢复。
(二)常见的err-disabled原因
-
BPDU Guard违规
-
Port Security违规
-
DHCP Snooping违规
-
ARP Inspection违规
-
UDLD错误
-
Loop Guard检测到环路
-
链路抖动
-
硬件故障
二、诊断err-disabled状态
(一)识别err-disabled端口
查看所有err-disabled端口:
Switch# show interfaces status err-disabled
示例输出:
PortName Status Vlan Duplex Speed Type
Gi1/0/5err-disabled1 a-full a-10010/100/1000BaseTX
Gi2/0/10err-disabled10 a-full a-10010/100/1000BaseTX
查看特定端口状态:
Switch# show interfaces gigabitEthernet1/0/5status
(二)查看错误原因
查看详细的错误信息:
Switch# show interfaces gigabitEthernet1/0/5status
查看端口安全违规信息:
Switch# show port-security interface gigabitEthernet1/0/5
查看日志信息:
Switch# show logging | include Gi1/0/5
查看errdisable状态:
Switch# show errdisable recovery
(三)查看errdisable恢复设置
查看自动恢复配置:
Switch# show errdisable recovery
示例输出:
ErrDisable Reason Timer Status
----------------- --------------
arp-inspection Disabled
bpduguard Enabled
dhcp-rate-limit Disabled
...
Timerinterval:300seconds
三、针对不同原因的处理方法
(一)BPDU Guard违规处理
查看BPDU Guard配置:
Switch# show spanning-tree interface gigabitEthernet1/0/5
检查端口是否启用了BPDU Guard:
Switch# show running-config interface gigabitEthernet1/0/5| include bpduguard
解决方法:
Switch# configure terminal
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# spanning-tree bpduguard disable
Switch(config-if)# shutdown
Switch(config-if)# no shutdown
Switch(config-if)# exit
或者启用自动恢复:
Switch(config)# errdisable recovery cause bpduguard
Switch(config)# errdisable recovery interval 300
(二)Port Security违规处理
查看端口安全状态:
Switch# show port-security interface gigabitEthernet1/0/5
查看安全地址表:
Switch# show port-security address
清除违规记录并恢复端口:
Switch# configure terminal
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# shutdown
Switch(config-if)# no switchport port-security
Switch(config-if)# switchport port-security
Switch(config-if)# no shutdown
Switch(config-if)# exit
或者清除特定违规:
Switch# clear port-security sticky gigabitEthernet1/0/5
Switch# clear port-security violation gigabitEthernet1/0/5
(三)DHCP Snooping违规处理
查看DHCP Snooping配置:
Switch# show ip dhcp snooping
查看DHCP绑定表:
Switch# show ip dhcp snooping binding
处理方法:
Switch# configure terminal
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# no ip dhcp snooping trust
Switch(config-if)# ip dhcp snooping trust
Switch(config-if)# shutdown
Switch(config-if)# no shutdown
Switch(config-if)# exit
启用自动恢复:
Switch(config)# errdisable recovery cause dhcp-rate-limit
(四)ARP Inspection违规处理
查看ARP Inspection状态:
Switch# show ip arp inspection
查看ARP ACL配置:
Switch# show ip arp inspection vlan [vlan-id]
处理方法:
Switch# configure terminal
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# no ip arp inspection trust
Switch(config-if)# ip arp inspection trust
Switch(config-if)# shutdown
Switch(config-if)# no shutdown
Switch(config-if)# exit
启用自动恢复:
Switch(config)# errdisable recovery cause arp-inspection
(五)UDLD错误处理
查看UDLD状态:
Switch# show udld neighbors
查看UDLD端口状态:
Switch# show udld gigabitEthernet1/0/5
处理方法:
Switch# configure terminal
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# udld port disable
Switch(config-if)# udld port
Switch(config-if)# shutdown
Switch(config-if)# no shutdown
Switch(config-if)# exit
或者全局重置UDLD:
Switch# udld reset
四、通用恢复方法
(一)手动恢复端口
方法一:关闭再开启端口:
Switch# configure terminal
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# shutdown
Switch(config-if)# no shutdown
Switch(config-if)# exit
方法二:直接启用端口(某些情况下):
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# no shutdown
(二)批量恢复err-disabled端口
创建恢复脚本:
Switch# configure terminal
Switch(config)# interface range gigabitEthernet 1/0/1-24
Switch(config-if-range)# shutdown
Switch(config-if-range)# exit
Switch(config)# interface range gigabitEthernet 1/0/1-24
Switch(config-if-range)# no shutdown
(三)清除特定原因的err-disable状态
清除所有err-disable状态:
Switch# errdisable recovery all
清除特定端口的err-disable状态:
Switch# clear errdisable interface gigabitEthernet1/0/5
五、预防措施配置
(一)配置自动恢复
启用各种原因的自动恢复:
Switch# configure terminal
Switch(config)# errdisable recovery cause bpduguard
Switch(config)# errdisable recovery cause psecure-violation
Switch(config)# errdisable recovery cause dhcp-rate-limit
Switch(config)# errdisable recovery cause arp-inspection
Switch(config)# errdisable recovery interval 300
(二)优化端口安全配置
配置合理的端口安全策略:
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security maximum 5
Switch(config-if)# switchport port-security violation restrict
Switch(config-if)# switchport port-security aging time 2
Switch(config-if)# switchport port-security aging type inactivity
(三)优化生成树配置
合理配置BPDU Guard:
Switch(config)# interface range gigabitEthernet 1/0/1-24
Switch(config-if-range)# spanning-tree bpduguard enable
Switch(config-if-range)# spanning-tree portfast
Switch(config)# interface gigabitEthernet 1/0/5
Switch(config-if)# spanning-tree portfast edge
六、监控和告警配置
(一)配置syslog告警
启用err-disable日志:
Switch(config)# logging trap notifications
Switch(config)# logging facility local0
Switch(config)# logging [syslog-server-ip]
Switch(config)# event manager applet ErrDisable-Detect
Switch(config-applet)# event syslog pattern "errdisable"
Switch(config-applet)# action 1.0 syslog msg "Port err-disabled detected"
(二)配置SNMP监控
配置SNMP社区:
Switch(config)# snmp-server community public RO
Switch(config)# snmp-server host [ip-address] public
Switch(config)# snmp-server enable traps snmp linkdown linkup
七、故障排除命令
(一)详细诊断命令
查看端口详细信息:
Switch# show interfaces gigabitEthernet1/0/5
查看端口计数器:
Switch# show interfaces gigabitEthernet1/0/5| include error|crc
查看端口历史事件:
Switch# show interfaces gigabitEthernet1/0/5| include Last
查看MAC地址表:
Switch# show mac address-table interface gigabitEthernet1/0/5
(二)硬件相关检查
查看端口硬件状态:
Switch# show interfaces gigabitEthernet1/0/5phy
查看端口光模块信息(光纤端口):
Switch# show interfaces gigabitEthernet1/0/5transceiver
查看端口供电状态(PoE端口):
Switch# show power inline gigabitEthernet1/0/5
八、最佳实践建议
(一)预防性配置
合理设置端口安全:
Switch(config)# interface range gigabitEthernet 1/0/1-24
Switch(config-if-range)# switchport port-security maximum 10
Switch(config-if-range)# switchport port-security violation restrict
Switch(config-if-range)# switchport port-security aging time 10
Switch(config-if-range)# spanning-tree bpduguard enable
Switch(config-if-range)# spanning-tree guard root
(二)监控配置
启用必要的自动恢复:
Switch(config)# errdisable recovery cause all
Switch(config)# errdisable recovery interval 600
Switch(config)# logging buffered 65536
Switch(config)# logging console warnings
(三)定期维护
定期检查err-disable端口:
Switch# show interfaces status err-disabled
定期清理MAC地址表:
Switch#clearmacaddress-tabledynamic
定期检查端口安全地址:
Switch# show port-security address
通过以上方法,您可以有效处理err-disabled状态,并建立预防机制避免类似问题再次发生。希望这篇文章能帮助您更好地管理和优化您的网络环境!
发表回复