Loopback Detection Configuration
show loopback-detection config
Section titled “show loopback-detection config”[Command]
show loopback-detection config
[Purpose]
View interface loopback detection status configuration information
[View]
System view
[Use Cases]
sonic# show loopback-detection configpackets interval time: 30 (sec)log interval time: 0 (sec)Port/Vlan Action Recovery-Time Status--------------------------------------------------------------------------------Vlan55 enableshow loopback-detection config
Section titled “show loopback-detection config”[Command]
show loopback-detection config
[Purpose]
View interface loopback detection interface status information
[View]
System view
[Use Cases]
sonic# show loopback-detection statusYou can re-up err-down ports one by one by "no shutdown" underinterface config, re-up all by "clear loopback-detection", orconfigure "loopback-detection recovery-time" for automatic recovery.loopback is detectedPort Status Caused By Time----------------------------------------------------------------------Ethernet57 shutdown Ethernet61,Vlan55 00:00:04Ethernet61 shutdown Ethernet57,Vlan55 00:00:04loopback-detection interval-time
Section titled “loopback-detection interval-time”[Command]
loopback-detection interval-time interval
[Purpose]
Configure interface loopback detection packet transmission interval
[Parameter]
| Parameter | Description |
|---|---|
| interval | Value range: 10-300, unit in seconds. Default value is 30 |
[View]
System configuration view
[Usage Scenario]
This command configures the interval for periodically sending loopback detection packets. Users can adjust the loopback detection packet transmission interval based on network conditions. A shorter interval results in more loopback detection packets being sent per unit of time, leading to more accurate interface loopback responses, but also consuming more system resources
[Use Cases]
sonic(config)# loopback-detection interval-time 10loopback-detection log-time
Section titled “loopback-detection log-time”[Command]
loopback-detection log-time interval
[Purpose]
Configure the interface loopback detection alarm message transmission interval
[Parameter]
| Parameter | Description |
|---|---|
| interval | Value range: 10-300, unit in seconds. Default value is 0 |
[View]
System configuration view
[Usage Scenario]
This command configures the interface loopback detection alarm message transmission interval, which specifies the period at which the information of disabled interfaces is printed. When the default value is 0, it means that the warning message will not be printed repeatedly.
[Use Cases]
sonic(config)# loopback-detection log-time 10loopback-detection enable
Section titled “loopback-detection enable”[Command]
loopback-detection enable
[Purpose]
Enable the loopback detection feature
[View]
Interface view、VLAN view
[Usage Scenario]
Network loops can cause devices to repeatedly send broadcast, multicast, and unknown unicast packets, leading to network resource waste and even network paralysis. To detect loops in a Layer 2 network in real time and prevent serious impacts on the entire network, a detection technology is needed. This technology should notify users promptly to check network connections and configurations when a loop is detected, and allow for placing the problematic interface into a controlled state. Loopback Detection is such a detection technology. It works by periodically sending detection packets from the interface, checking whether the packets return to the device (without requiring the same interface for both sending and receiving). This helps determine if there is a loop in the interface, the network or device connected to the device, or between two interfaces on the device. Upon detecting a loop, the loopback detection function triggers an alarm, logs the event, and, based on user-configured settings, processes the interface (by default, disabling it). This places the interface into a controlled state, reducing the impact of the loop on the device and the entire network.
[Commit] Configurations in the VLAN view apply to all ports within the specified VLAN, while configurations in the interface view apply only to the current port.
[Use Cases]
sonic(config)# vlan 10sonic(config-vlan-10)# loopback-detection enableloopback-detection action
Section titled “loopback-detection action”[Command]
loopback-detection action {logging|shutdown}
[Purpose]
Configure the loopback detection handling action for the interface
[Parameter]
| Parameter | Description |
|---|---|
| logging | The interface only reports an alarm. |
| shutdown | The interface is shut down. |
[View]
Interface view
[Usage Scenario]
After enabling interface loopback detection, the interface will periodically check if it sends a loopback. When the device detects a loop on the interface, the configuration set by this command can be used to take action on the interface, quickly minimizing the impact of the loop on the entire network
[Notes]
When the device detects a loop, it will automatically bring down the interface that received the detection packet. However, the POE power supply to the interface will not be affected.
[Use Cases]
sonic(config)# interface ethernet 57sonic(config-if-57)# loopback-detection action loggingloopback-detection recovery-time
Section titled “loopback-detection recovery-time”[Command]
loopback-detection recovery-time interval
[Purpose]
Configure the time for the interface to automatically recover to normal state after detecting a loopback
[Parameter]
| Parameter | Description |
|---|---|
| interval | Value range: 10-65535, unit in seconds |
[View]
Interface view
[Usage Scenario]
After enabling interface loopback detection, the interface will periodically send loopback detection packets. Upon detecting a loop, the configured action will be applied to the interface, and a timer will start. Users can configure the interface recovery time. After the specified recovery-time, the system will attempt to recover the interface. If the loop is cleared by that time, the interface will be restored to its normal state.
[Use Cases]
sonic(config)# interface ethernet 57sonic(config-if-57)# loopback-detection recovery-time 60clear loopback-detection
Section titled “clear loopback-detection”[Command]
clear loopback-detection
[Purpose]
Clear loopback detection information and enable all interfaces that are in a shutdown state
[View]
System view
[Usage Scenario]
When the loopback detection action is set to shutdown, after the loop is cleared, the interfaces that were error-disabled cannot automatically recover. You must manually execute the shutdown and no shutdown commands to restore the interface. Alternatively, you can use the clear loopback-detection command to restart all interfaces that were shutdown
[Use Cases]
sonic# clear loopback-detection