As shown in Figure 1, a small-scale enterprise uses Layer 2 networking and belongs to VLAN 100. Because employees often move, the network topology changes frequently. Loops may occur due to incorrect connections or configurations during the change. As a result, broadcast storms may occur and affect communication of the Switch and entire network.
The requirements are as follows: The Switch detects loops. When a loop exists, the interface is blocked to reduce the impact of the loop on the Switch and network. When the loop is eliminated, the interface can be restored.
To detect loops on the network where the Switch is deployed, configure LBDT on GE0/0/1 and GE0/0/2 of the Switch. In this example, untagged LBDT packets sent by the Switch will be discarded by other switches on the network. As a result, the packets cannot be sent back to the Switch, and LBDT fails. Therefore, LBDT is configured in a specified VLAN. The configuration roadmap is as follows:
Configure interfaces on other switching interfaces as trunk or hybrid interfaces and configure these interfaces to allow packets from VLANs to pass through to ensure Layer 2 connectivity.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] loopback-detect enable [Switch-GigabitEthernet0/0/1] quit [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] loopback-detect enable [Switch-GigabitEthernet0/0/2] quit
[Switch] vlan 100 [Switch-vlan100] quit [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type hybrid [Switch-GigabitEthernet0/0/1] port hybrid tagged vlan 100 [Switch-GigabitEthernet0/0/1] loopback-detect packet vlan 100 [Switch-GigabitEthernet0/0/1] quit [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] port link-type hybrid [Switch-GigabitEthernet0/0/2] port hybrid tagged vlan 100 [Switch-GigabitEthernet0/0/2] loopback-detect packet vlan 100 [Switch-GigabitEthernet0/0/2] quit
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] loopback-detect action block [Switch-GigabitEthernet0/0/1] loopback-detect recovery-time 30 [Switch-GigabitEthernet0/0/1] quit [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] loopback-detect action block [Switch-GigabitEthernet0/0/2] loopback-detect recovery-time 30 [Switch-GigabitEthernet0/0/2] quit
Run the display loopback-detect command to check the LBDT configuration.
[Switch] display loopback-detect Loopback-detect sending-packet interval: 5 (A): Auto Loopback-detect ----------------------------------------------------------------- Interface RecoverTime Action Status ----------------------------------------------------------------- GigabitEthernet0/0/1 30 block NORMAL GigabitEthernet0/0/2 30 block NORMAL -----------------------------------------------------------------
The preceding command output shows that the LBDT configuration is successful.
After about 5s, run the display loopback-detect command to check whether GE0/0/1 or GE0/0/2 is blocked.
[Switch] display loopback-detect Loopback-detect sending-packet interval: 5 (A): Auto Loopback-detect ----------------------------------------------------------------- Interface RecoverTime Action Status ----------------------------------------------------------------- GigabitEthernet0/0/1 30 block NORMAL GigabitEthernet0/0/2 30 block BLOCK -----------------------------------------------------------------
The preceding command output shows that GE0/0/2 is blocked.
Shut down GE0/0/1. After 30s, run the display loopback-detect command to check whether GE0/0/2 is restored.
[Switch] display loopback-detect Loopback-detect sending-packet interval: 5 (A): Auto Loopback-detect ----------------------------------------------------------------- Interface RecoverTime Action Status ----------------------------------------------------------------- GigabitEthernet0/0/1 30 block NORMAL GigabitEthernet0/0/2 30 block NORMAL -----------------------------------------------------------------
The preceding command output shows that GE0/0/2 is restored.
Switch configuration file
# sysname Switch # vlan batch 100 # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid tagged vlan 100 loopback-detect recovery-time 30 loopback-detect packet vlan 100 loopback-detect enable loopback-detect action block # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid tagged vlan 100 loopback-detect recovery-time 30 loopback-detect packet vlan 100 loopback-detect enable loopback-detect action block # return