Example for Configuring MAC Address Flapping Detection
Networking Requirements
In Figure 2-19, a loop occurs on a user network because two LSWs are incorrectly connected using a network cable. This loop causes MAC address flapping on 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. To remove loops on the network, configure an action against MAC address flapping on the interfaces.
Configuration Roadmap
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 remove loops.
Procedure
- Enable MAC address flapping detection.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] mac-address flapping detection
- Set the aging time of flapping MAC addresses.
[Switch] mac-address flapping aging-time 500
- Configure the action against MAC address flapping as error-down on the GE1/0/1 and GE1/0/2.
[Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] mac-address flapping action error-down [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 1/0/2 [Switch-GigabitEthernet1/0/2] mac-address flapping action error-down [Switch-GigabitEthernet1/0/2] quit
- Enable error-down interfaces to go Up automatically
and set the automatic recovery time. In the following configuration,
it is set to 500s.
[Switch] error-down auto-recovery cause mac-address-flapping interval 500
- Verify the configuration.
When the MAC address learned on the GE moves to GE1/0/2, GE1/0/2 is shut down automatically. You can 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 GE1/0/1 GE1/0/2(D) 83 E:2012-04-01 17:22:44 ------------------------------------------------------------------------------- Total items on slot 1: 1
Configuration Files
Switch configuration file
# sysname Switch # error-down auto-recovery cause mac-address-flapping interval 500 # mac-address flapping aging-time 500 # interface GigabitEthernet1/0/1 mac-address flapping action error-down # interface GigabitEthernet1/0/2 mac-address flapping action error-down # return