跳转到内容

Loopback Detection Configuration

此内容尚不支持你的语言。

Loopback Detection is a Layer 2 network protection mechanism used to promptly detect and handle loops in the network. Network loops can cause broadcast, multicast, and unknown unicast packets to be sent repeatedly, resulting in waste of network resources or even network paralysis. The loop detection function periodically sends detection packets through the interface and checks whether the packets return to the device, thereby determining whether there is a loop under the interface or VLAN. Once a loop is detected, the device will send an alarm, record logs, and process the interface according to user configurations (such as shutting down the interface), putting the interface into a controlled state to minimize the impact of the loop on the network.

The implementation of loop detection is based on the following working mechanism:

On interfaces or VLANs with loop detection enabled, the device sends detection packets at fixed time intervals (configured via loopback-detection interval-time). The detection packets are sent in broadcast mode, with the destination MAC address being the broadcast address, the Ethernet type being 0x9998, and the packet payload containing the sending port name or VLAN information.

Loop detection supports two detection granularities:

  • Interface-based detection: After enabling loop detection in the interface view, the device only sends detection packets from the interface itself and monitors whether it receives the packets it sent from the same interface. If received, it is determined that there is a loop in the network connected to this interface, and the configured action for the interface is triggered.
  • VLAN-based detection: After enabling loop detection in the VLAN view, the device sends detection packets on all member interfaces within the VLAN and monitors whether any interface in the VLAN receives the packets it sent. As long as the packet is received by any interface in the VLAN (which can be a different port from the sending interface), it is determined that there is a loop in the VLAN, and the configured action for the interfaces in the VLAN is triggered.

After detecting a loop, the device immediately executes the configured processing action: by default, shutting down the interface (shutdown) or only recording a log (logging). After the interface is shut down, the device continuously monitors the loop status. If an automatic recovery time is configured (loopback-detection recovery-time), the device will attempt to recover the interface after this time; if the loop has been eliminated, the interface returns to its normal state; otherwise, it remains in a controlled state. Users can also manually recover the shut-down interface (via no shutdown or clear loopback-detection).

OperationDescription
Configure the sending cycle of detection messagesOptional (Global)
Configure the sending cycle of alarm logsOptional (Global)
Enable the loop detection function of the interface/VLANMandatory (Interface/VLAN)
Configure loop detection processing actionsOptional (Interface)
Configure the automatic recovery time of the interfaceOptional (Interface)

Configure the Sending Cycle of Detection Messages

Section titled “Configure the Sending Cycle of Detection Messages”

Use this command to set the sending interval of loop detection packets. The smaller the interval, the higher the detection sensitivity, but the greater the system resource consumption.

OperationCommandDescription
Enter the system configuration viewconfigure terminal-
Configure the sending cycle**loopback-detection interval-time *** interval *interval: The value range is 10 to 300 seconds, with a default of 30 seconds.

This command sets the interval at which the system repeatedly prints alarm logs after an interface is shut down due to a loop. The default value of 0 means that repeated printing is not performed.

OperationCommandDescription
Enter the system configuration viewconfigure terminal-
Configure the log sending cycle**loopback-detection log-time *** interval *interval: The value range is 10–300 seconds, with a default of 0 seconds

Enable the Loop Detection Function of the Interface/VLAN

Section titled “Enable the Loop Detection Function of the Interface/VLAN”

When configured in the interface view, it only takes effect on the current interface and adopts an interface-based detection mechanism; when configured in the VLAN configuration view, it takes effect on all ports within the VLAN and adopts a VLAN-based detection mechanism.

OperationCommandDescription
Enter the interface configuration view**interface ethernet *** interface-id *-
Enable interface loop detectionloopback-detection enable-
Or enter the VLAN configuration view**vlan *** vlan-id *-
Enable VLAN loop detectionloopback-detection enable-

Configure Loop Detection Processing Actions

Section titled “Configure Loop Detection Processing Actions”

The action that the device performs on the interface when a loop is detected.

OperationCommandDescription
Enter the interface configuration view**interface ethernet *** interface-id *-
Configure actionloopback-detection action {logging | shutdown}logging: Only record logs;
shutdown: Record logs and close the interface (default)

Configure the Automatic Recovery Time of the Interface

Section titled “Configure the Automatic Recovery Time of the Interface”

After the interface is shut down due to a loop, how long will it take to automatically attempt to return to the normal state? If the loop has disappeared after recovery, the interface will be re-enabled.

OperationCommandDescription
Enter the interface configuration view**interface ethernet *** interface-id *-
Configuration recovery time**loopback-detection recovery-time *** interval *interval : The value range is 10 to 65535 seconds

hint{type=“warning”} NOTE: The command “show loopback-detection status” only displays real-time loop detection events. When an interface is shut down due to a loop and the loop disappears for a period of time (3 times the interval), the command will no longer display relevant information. In this case, if you need to check the interfaces that have been shut down by loop detection, please use the “show interface errdown” command. “Time” indicates the time elapsed since the last detected loop.