Example for Configuring LDT to Detect Loops on the Downstream Network
Networking Requirements
As shown in Figure 20-5, a new branch network of an enterprise connects to the aggregation switch Switch, and VLANs 10 to 20 are deployed on the branch network. Loops may occur due to incorrect connections or configurations. As a result, communication on the Switch and uplink network may be Haffected.
It is required that the Switch should immediately detect loops on the new branch network to prevent the impact of loops on the Switch and uplink network.
Configuration Roadmap
Loops need to be detected in VLANs 10 to 20 (more than eight VLANs) on the new branch network, so you need to configure LDT on the Switch to detect loops on the new branch network. The configuration roadmap is as follows:
- Enable LDT on the GE1/0/1 of the Switch to detect loops in a specified VLAN so that loops on the downstream network can be detected.
- Configure an action after loops are detected so that the Switch can immediately shut down the interface where a loop is detected. This prevents the impact of the loop on the Switch and uplink network.
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 on the new branch network and between the new branch network and the Switch.
The configurations in this example can also be performed to detect loopbacks on interfaces connecting switching devices.
Procedure
- Enable global LDT.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] loop-detection enable
- Enable LDT in VLANs.
[Switch] vlan batch 10 to 20 [Switch] loop-detection enable vlan 10 to 20
- Set the interval for sending LDT packets on the interface.
[Switch] loop-detection interval-time 10
- Configure an action taken after a loop is detected.
# Enable the trap function for LDT.
[Switch] snmp-agent trap enable feature-name ldttrap
Set the action to Shutdown.
[Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] port link-type hybrid [Switch-GigabitEthernet1/0/1] stp disable [Switch-GigabitEthernet1/0/1] port hybrid tagged vlan 10 to 20 [Switch-GigabitEthernet1/0/1] loop-detection mode port-shutdown [Switch-GigabitEthernet1/0/1] quit
- Verify the configuration.
# After the configuration is complete, run the display loop-detection command to check global LDT information.
[Switch] display loop-detection Loop Detection is enabled. Detection interval time is 10 seconds. Following VLANs enable loop-detection: VLAN 10 to 20 Following ports are blocked for loop: NULL Following ports are shutdown for loop: GigabitEthernet1/0/1 Include Vlans: 10 Following ports are nolearning for loop: NULL Following ports are trapped for loop: NULL Following ports are quitvlan for loop: NULL
# Check LDT information on GE1/0/1.
[Switch] display loop-detection interface gigabitethernet 1/0/1 The port is enabled. The port's status list: Status WorkMode Recovery-time EnabledVLAN ----------------------------------------------------------------------- Shutdown Shutdown 255 10 Normal Shutdown 255 11 Normal Shutdown 255 12 Normal Shutdown 255 13 Normal Shutdown 255 14 Normal Shutdown 255 15 Normal Shutdown 255 16 Normal Shutdown 255 17 Normal Shutdown 255 18 Normal Shutdown 255 19 Normal Shutdown 255 20
The command output shows that LDT is enabled in VLAN 10 to VLAN 20 and the Shutdown action is taken on GE1/0/1 in VLAN 10, indicating that a loop is detected in VLAN 10.
When the system detects loops in one or more VLANs, the Shutdown action is taken on the interface. The loops are therefore eliminated; however, loops in all VLANs cannot be detected.
Configuration Files
Switch configuration file
# sysname Switch # vlan batch 10 to 20 # loop-detection enable loop-detection interval-time 10 loop-detection enable vlan 10 to 20 # interface GigabitEthernet1/0/1 port link-type hybrid port hybrid tagged vlan 10 to 20 stp disable # snmp-agent snmp-agent local-engineid 800007DB03020000000211 snmp-agent sys-info version v3 snmp-agent trap enable feature-name LDTTRAP # return