- Table of Contents
-
- 03-Layer 2—LAN Switching Command Reference
- 00-Preface
- 01-Ethernet interface commands
- 02-Loopback, null, and inloopback interface commands
- 03-Bulk interface commands
- 04-MAC address table commands
- 05-Ethernet link aggregation commands
- 06-Port isolation commands
- 07-Spanning tree commands
- 08-Loop detection commands
- 09-VLAN commands
- 10-MVRP commands
- 11-QinQ commands
- 12-VLAN mapping commands
- 13-LLDP commands
- 14-Cut-through forwarding commands
Title | Size | Download |
---|---|---|
08-Loop detection commands | 47.98 KB |
Loop detection commands
display loopback-detection
Use display loopback-detection to display the loop detection configuration and status.
Syntax
display loopback-detection
Views
Any view
Predefined user roles
network-admin
network-operator
Example
# Display the loop detection configuration and status.
<Sysname> display loopback-detection
Loopback detection is enabled.
Loopback detection interval is 30 second(s).
Loopback is detected on following interfaces:
Interface Action mode
Ten-GigabitEthernet1/0/1 Block
Ten-GigabitEthernet1/0/2 Shutdown
Ten-GigabitEthernet1/0/3 None
Ten-GigabitEthernet1/0/4 No-learning
Table 1 Command output
Field |
Description |
Action mode |
Loop protection action: · Block—When a loop is detected on a port, the device generates a log, disables the port from learning MAC addresses, and blocks inbound traffic on the port. · None—When a loop is detected on a port, the device generates a log but performs no action on the port. · No-learning—When a loop is detected on a port, the device generates a log and disables the port from learning MAC addresses. · Shutdown—When a loop is detected on a port, the device generates a log and shuts down the port to disable it from receiving and sending any frames. The device automatically brings up the port after the detection timer expires. You can use the shutdown-interval command to set the detection timer. For more information, see Fundamentals Command Reference. |
loopback-detection action
Use loopback-detection action to configure the loop protection action on a port.
Use undo loopback-detection action to restore the default.
Syntax
In Layer 2 Ethernet interface view:
loopback-detection action { block | no-learning | shutdown }
undo loopback-detection action
In Layer 2 aggregate interface view:
loopback-detection action shutdown
undo loopback-detection action
Default
When the device detects a loop on a port, it generates a log but performs no action on the port.
Views
Layer 2 Ethernet interface view, Layer 2 aggregate interface view
Predefined user roles
network-admin
Parameters
block: Enables the block mode. If a loop is detected, the device disables MAC address learning and blocks inbound traffic on the port, in addition to generating a log. Layer 2 aggregate interfaces do not support this keyword.
no-learning: Enables the no-learning mode. If a loop is detected, the device generates a log and disables MAC address learning on the port. Layer 2 aggregate interfaces do not support this keyword.
shutdown: Enables the shutdown mode. If a loop is detected, the device generates a log and shuts down the port. The device automatically brings up the port after the detection timer expires. You can use the shutdown-interval command to set the detection timer. For more information, see Fundamentals Command Reference.
Usage guidelines
To configure the loop protection action globally, use the loopback-detection global action command.
The global configuration applies to all ports. The per-port configuration applies to the individual ports. The per-port configuration takes precedence over the global configuration.
Example
# Set the loop protection action to shutdown on port Ten-GigabitEthernet 1/0/1.
<Sysname> system-view
[Sysname] interface ten-gigabitethernet 1/0/1
[System-Ten-GigabitEthernet1/0/1] loopback-detection action shutdown
· display loopback-detection
· loopback-detection global action
loopback-detection enable
Use loopback-detection enable to enable loop detection on a port.
Use undo loopback-detection enable to disable loop detection on a port.
Syntax
loopback-detection enable vlan { vlan-list | all }
undo loopback-detection enable vlan { vlan-list | all }
Default
The loop detection function is disabled on ports.
Views
Layer 2 Ethernet interface view, Layer 2 aggregate interface view
Predefined user roles
network-admin
Parameters
vlan-list: Specifies a VLAN list, in the format of { vlan-id [ to vlan-id ] }&<1-10>, where vlan-id represents the VLAN ID in the range of 1 to 4094, and &<1-10> indicates that you can specify up to 10 vlan-id [ to vlan-id ] parameters.
all: Specifies all existing VLANs.
Usage guidelines
To enable loop detection globally, use the loopback-detection global enable command.
The loop protection action on a port can be triggered even if loop detection is disabled on the port when the following requirements are met:
· Loop detection is enabled globally or on any other port on the device.
· The port receives a loop detection frame of any VLAN.
Example
# Enable loop detection on port Ten-GigabitEthernet 1/0/1 for VLAN 10 through VLAN 20.
<Sysname> system-view
[Sysname] interface ten-gigabitethernet 1/0/1
[System-Ten-GigabitEthernet1/0/1] loopback-detection enable vlan 10 to 20
· display loopback-detection
· loopback-detection global enable
loopback-detection global action
Use loopback-detection global action to configure the global loop protection action.
Use undo loopback-detection global action to restore the default.
Syntax
loopback-detection global action shutdown
undo loopback-detection global action
Default
When the device detects a loop on a port, it generates a log but performs no action on the port.
Views
System view
Predefined user roles
network-admin
Parameters
shutdown: Enables the shutdown mode. If a loop is detected, the device generates a log and shuts down the port. The device automatically brings up the port after the detection timer expires. You can use the shutdown-interval command to set the detection timer. For more information, see Fundamentals Command Reference.
Usage guidelines
To configure the loop protection action on a per-port basis, use the loopback-detection action command in interface view.
The global configuration applies to all ports. The per-port configuration applies to the individual ports. The per-port configuration takes precedence over the global configuration.
Example
# Set the global loop protection action to shutdown.
<Sysname> system-view
[System] loopback-detection global action shutdown
Related commands
· display loopback-detection
· loopback-detection action
loopback-detection global enable
Use loopback-detection global enable to enable loop detection globally.
Use undo loopback-detection global enable to disable loop detection globally.
Syntax
loopback-detection global enable vlan { vlan-list | all }
undo loopback-detection global enable vlan { vlan-list | all }
Default
The loop detection function is globally disabled.
Views
System view
Predefined user roles
network-admin
Parameters
vlan-list: Specifies a VLAN list, in the format of { vlan-id [ to vlan-id ] }&<1-10>, where vlan-id represents the VLAN ID in the range of 1 to 4094, and &<1-10> indicates that you can specify up to 10 vlan-id [ to vlan-id ] parameters.
all: Specifies all existing VLANs.
Usage guidelines
To enable loop detection on a per-port basis, use the loopback-detection enable command in interface view.
The loop protection action on a port can be triggered even if loop detection is disabled on the port when the following requirements are met:
· Loop detection is enabled globally or on any other port on the device.
· The port receives a loop detection frame of any VLAN.
Example
# Globally enable loop detection for VLAN 10 through VLAN 20.
<Sysname> system-view
[System] loopback-detection global enable vlan 10 to 20
Related commands
· display loopback-detection
· loopback-detection enable
loopback-detection interval-time
Use loopback-detection interval-time to set the loop detection interval.
Use undo loopback-detection interval-time to restore the default.
Syntax
loopback-detection interval-time interval
undo loopback-detection interval-time
Default
The loop detection interval is 30 seconds.
Views
System view
Predefined user roles
network-admin
Parameters
interval: Sets the loop detection interval in the range of 1 to 300 seconds.
Usage guidelines
With loop detection enabled, the device sends loop detection frames at the specified interval. A shorter interval offers more sensitive detection but consumes more resources. Consider the system performance and loop detection speed when you set the loop detection interval.
Example
# Set the loop detection interval to 10 seconds.
<Sysname> system-view
[Sysname] loopback-detection interval-time 10
Related commands
display loopback-detection