In Figure 1, a loop occurs on a network because two LSWs are connected in error using a network cable. The loop causes MAC address flapping in the MAC address table of the Switch.
To detect loops in a timely manner, configure MAC address flapping detection on the Switch. This function enables the Switch to detect loops by checking whether a MAC address flaps between interfaces, facilitating troubleshooting.
The configuration roadmap is as follows:
Enable MAC address flapping detection.
Set the aging time of flapping MAC addresses.
Configure an action against MAC address flapping on the interfaces to eliminate loops.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] mac-address flapping detection
[Switch] mac-address flapping aging-time 500
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] mac-address flapping action error-down [Switch-GigabitEthernet0/0/1] quit [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] mac-address flapping action error-down [Switch-GigabitEthernet0/0/2] quit
[Switch] error-down auto-recovery cause mac-address-flapping interval 500
When the MAC address learned on the GE0/0/1 moves to GE0/0/2, GE0/0/2 is shut down automatically. Run the display mac-address flapping record command to view MAC address flapping records.
[Switch] display mac-address flapping record S : start time E : end time (Q) : quit vlan (D) : error down ------------------------------------------------------------------------------- Move-Time VLAN MAC-Address Original-Port Move-Ports MoveNum ------------------------------------------------------------------------------- S:2012-04-01 17:22:36 1 0000-0000-0007 GE0/0/1 GE0/0/2(D) 83 E:2012-04-01 17:22:44 ------------------------------------------------------------------------------- Total items on slot 0: 1
Switch configuration file
# sysname Switch # error-down auto-recovery cause mac-address-flapping interval 500 # mac-address flapping aging-time 500 # interface GigabitEthernet0/0/1 mac-address flapping action error-down # interface GigabitEthernet0/0/2 mac-address flapping action error-down # return