Example for Configuring LBDT to Detect Loops on the Local Network
Networking Requirements
As shown in Figure 20-9, 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.
Configuration Roadmap
To detect loops on the network where the Switch is deployed, configure LBDT on GE1/0/1 and GE1/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:
- Enable LBDT on an interface and configure the Switch to detect loops in VLAN 100 to implement LBDT on the network where the Switch is deployed.
- Configure an action taken after a loop is detected and set the recovery time. After a loop is detected, the Switch blocks the interface to reduce the impact of the loop on the network. After a loop is eliminated, the Switch restores the interface.
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.
Procedure
- Enable LBDT on an interface.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] loopback-detect enable [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 1/0/2 [Switch-GigabitEthernet1/0/2] loopback-detect enable [Switch-GigabitEthernet1/0/2] quit
- Specify the VLAN ID of LBDT packets.
[Switch] vlan 100 [Switch-vlan100] quit [Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] port link-type hybrid [Switch-GigabitEthernet1/0/1] port hybrid tagged vlan 100 [Switch-GigabitEthernet1/0/1] loopback-detect packet vlan 100 [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 1/0/2 [Switch-GigabitEthernet1/0/2] port link-type hybrid [Switch-GigabitEthernet1/0/2] port hybrid tagged vlan 100 [Switch-GigabitEthernet1/0/2] loopback-detect packet vlan 100 [Switch-GigabitEthernet1/0/2] quit
- Configure an action taken after a loop is detected and
set the recovery time.
[Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] loopback-detect action block [Switch-GigabitEthernet1/0/1] loopback-detect recovery-time 30 [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 1/0/2 [Switch-GigabitEthernet1/0/2] loopback-detect action block [Switch-GigabitEthernet1/0/2] loopback-detect recovery-time 30 [Switch-GigabitEthernet1/0/2] quit
- Verify the configuration.
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 ----------------------------------------------------------------- GigabitEthernet1/0/1 30 block NORMAL GigabitEthernet1/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 GE1/0/1 or GE1/0/2 is blocked.
[Switch] display loopback-detect Loopback-detect sending-packet interval: 5 (A): Auto Loopback-detect ----------------------------------------------------------------- Interface RecoverTime Action Status ----------------------------------------------------------------- GigabitEthernet1/0/1 30 block NORMAL GigabitEthernet1/0/2 30 block BLOCK -----------------------------------------------------------------
The preceding command output shows that GE1/0/2 is blocked.
Shut down GE1/0/1. After 30s, run the display loopback-detect command to check whether GE1/0/2 is restored.
[Switch] display loopback-detect Loopback-detect sending-packet interval: 5 (A): Auto Loopback-detect ----------------------------------------------------------------- Interface RecoverTime Action Status ----------------------------------------------------------------- GigabitEthernet1/0/1 30 block NORMAL GigabitEthernet1/0/2 30 block NORMAL -----------------------------------------------------------------
The preceding command output shows that GE1/0/2 is restored.
Configuration Files
Switch configuration file
# sysname Switch # vlan batch 100 # interface GigabitEthernet1/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 GigabitEthernet1/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