04-Network Connectivity

HomeSupportResource CenterH3C Access Points Cloud Mode Configuration Guides(E2442 R2442)-6W10004-Network Connectivity
06-Loop detection configuration
Title Size Download
06-Loop detection configuration 118.75 KB

Configuring loop detection

About loop detection

The loop detection mechanism performs periodic checking for Layer 2 loops. The mechanism immediately generates a log message when a loop occurs so that you are promptly notified to adjust network connections and configurations. You can configure loop detection to shut down the looped port. Logs are maintained in the information center. For more information, see System Management Configuration Guide.

Loop detection mechanism

The device detects loops by sending detection frames and then checking whether these frames return to any port on the device. If they do, the device considers that the port is on a looped link.

Figure 1 Ethernet frame header for loop detection

The Ethernet frame header of a loop detection packet contains the following fields:

·     DMACDestination MAC address of the frame, which is the multicast MAC address 010f-e200-0007. When a loop detection-enabled device receives a frame with this destination MAC address, it performs the following operations:

¡     Sends the frame to the CPU.

¡     Floods the frame in the VLAN from which the frame was originally received.

·     SMACSource MAC address of the frame, which is the bridge MAC address of the sending device.

·     TPIDType of the VLAN tag, with the value of 0x8100.

·     TCIInformation of the VLAN tag, including the priority and VLAN ID.

·     TypeProtocol type, with the value of 0x8918.

Figure 2 Inner frame header for loop detection

The inner frame header of a loop detection packet contains the following fields:

·     CodeProtocol sub-type, which is 0x0001, indicating the loop detection protocol.

·     VersionProtocol version, which is always 0x0000.

·     LengthLength of the frame. The value includes the inner header, but excludes the Ethernet header.

·     ReservedThis field is reserved.

Frames for loop detection are encapsulated as TLV triplets.

Table 1 TLVs supported by loop detection

TLV

Description

Remarks

End of PDU

End of a PDU.

Optional.

Device ID

Bridge MAC address of the sending device.

Required.

Port ID

ID of the PDU sending port.

Optional.

Port Name

Name of the PDU sending port.

Optional.

System Name

Device name.

Optional.

Chassis ID

Chassis ID of the sending port.

Optional.

Slot ID

Slot ID of the sending port.

Optional.

Sub Slot ID

Sub-slot ID of the sending port.

Optional.

Loop detection interval

Loop detection is a continuous process as the network changes. Loop detection frames are sent at the loop detection interval to determine whether loops occur on ports and whether loops are removed.

Loop protection actions

When detecting a loop on a port, the device by default logs the loop event without taking any action on the port. You can configure the device to take one of the following actions:

·     Block—Disables the port from learning MAC addresses and blocks the port.

·     No-learning—Disables the port from learning MAC addresses.

·     Shutdown—Shuts down the port to disable it from receiving and sending any frames.

Port status auto recovery

When the device configured with the block or no-learning loop action detects a loop on a port, it performs the action and waits three loop detection intervals. If the device does not receive a loop detection frame within three loop detection intervals, it performs the following operations:

·     Automatically sets the port to the forwarding state.

·     Notifies the user of the event.

When the device configured with the shutdown action detects a loop on a port, the following events occur:

1.     The device automatically shuts down the port.

2.     The device automatically sets the port to the forwarding state after the detection timer set by using the shutdown-interval command expires. For more information about the shutdown-interval command, see System Management Command Reference.

3.     The device shuts down the port again if a loop is still detected on the port when the detection timer expires.

This process is repeated until the loop is removed.

 

 

NOTE:

Incorrect recovery can occur when loop detection frames are discarded to reduce the load. To avoid this, use the shutdown action, or manually remove the loop.

 

Loop detection tasks at a glance

To configure loop detection, perform the following tasks:

1.     Enabling loop detection

¡     Enabling loop detection globally

¡     Enabling loop detection on a port

2.     (Optional) Setting the loop protection action

¡     Setting the global loop protection action

¡     Setting the loop protection action on an interface

3.     (Optional) Setting the loop detection interval

Enabling loop detection

Restrictions and guidelines for loop detection configuration

When you enable loop detection, follow these restrictions and guidelines:

·     You can enable loop detection globally or on a per-port basis. When a port receives a detection frame in any VLAN, the loop protection action is triggered on that port, regardless of whether loop detection is enabled on it.

Enabling loop detection globally

1.     Enter system view.

system-view

2.     Globally enable loop detection.

loopback-detection global enable vlan { vlan-id--list | all }

By default, loop detection is globally disabled.

Enabling loop detection on a port

1.     Enter system view.

system-view

2.     Enter Layer 2 Ethernet interface view or Layer 2 aggregate interface view.

interface interface-type interface-number

3.     Enable loop detection on the port.

loopback-detection enable vlan { vlan-id--list | all }

By default, loop detection is disabled on ports.

Setting the loop protection action

Restrictions and guidelines for loop protection action configuration

You can set the loop protection action globally or on a per-port basis. The global action applies to all ports. The per-port action applies to the individual ports. The per-port action takes precedence over the global action.

Setting the global loop protection action

1.     Enter system view.

system-view

2.     Set the global loop protection action.

loopback-detection global action shutdown

By default, the device logs the event without taking any action on the port on which a loop is detected.

Setting the loop protection action on an interface

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Set the loop protection action on the interface.

loopback-detection action { block | no-learning | shutdown }

By default, the device logs the event without taking action on the port on which a loop is detected.

Support for the keywords of this command varies by interface type. For more information, see Layer 2LAN Switching Command Reference.

Setting the loop detection interval

About this task

With loop detection enabled, the device sends loop detection frames at the loopback detection 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.

Procedure

1.     Enter system view.

system-view

2.     Set the loop detection interval.

loopback-detection interval-time interval

The default setting is 30 seconds.

Display and maintenance commands for loop detection

Execute display commands in any view.

 

Task

Command

Display the loop detection configuration and status.

display loopback-detection

Loop detection configuration examples

Example: Configuring basic loop detection functions

Network configuration

As shown in Figure 3, the AP is attached to a a ring network. To avoid loops, configure loop detection on the AP to automatically shut down the port attached to the network when a loop occurs in addition to log the event.

Figure 3 Network diagram

Procedure

 

1.     Configure the AP:

# Configure GigabitEthernet 1/0/1 as a trunk port, and assign it to VLAN 100.

<AP> system-view

[AP] vlan 100

[AP-vlan100] quit

[AP] interface gigabitethernet 1/0/1

[AP-GigabitEthernet1/0/1] port link-type trunk

[AP-GigabitEthernet1/0/1] port trunk permit vlan 100

# Enable loop detection on GigabitEthernet 1/0/1.

[AP-GigabitEthernet1/0/1] loopback-detection enable vlan 100

# Set the loop protection action to shutdown.

[AP-GigabitEthernet1/0/1] loopback-detection action shutdown

[AP-GigabitEthernet1/0/1] quit

# Set the loop detection interval to 35 seconds.

[AP] loopback-detection interval-time 35

2.     Configure Switch A:

# Create VLAN 100.

<SwitchA> system-view

[SwitchA] vlan 100

[SwitchA–vlan100] quit

# Configure GigabitEthernet 1/0/2 and GigabitEthernet 1/0/3 as trunk ports, and assign them to VLAN 100.

[SwitchA] interface gigabitethernet 1/0/2

[SwitchA-GigabitEthernet1/0/2] port link-type trunk

[SwitchA-GigabitEthernet1/0/2] port trunk permit vlan 100

[SwitchA-GigabitEthernet1/0/2] quit

[SwitchA] interface gigabitethernet 1/0/3

[SwitchA-GigabitEthernet1/0/3] port link-type trunk

[SwitchA-GigabitEthernet1/0/3] port trunk permit vlan 100

[SwitchA-GigabitEthernet1/0/3] quit

3.     Configure Switch B:

# Create VLAN 100.

<SwitchB> system-view

[SwitchB] vlan 100

[SwitchB–vlan100] quit

# Configure GigabitEthernet 1/0/1 and GigabitEthernet 1/0/2 as trunk ports, and assign them to VLAN 100.

[SwitchB] interface gigabitethernet1/0/1

[SwitchB-GigabitEthernet1/0/1] port link-type trunk

[SwitchB-GigabitEthernet1/0/1] port trunk permit vlan 100

[SwitchB-GigabitEthernet1/0/1] quit

[SwitchB] interface gigabitethernet 1/0/2

[SwitchB-GigabitEthernet1/0/2] port link-type trunk

[SwitchB-GigabitEthernet1/0/2] port trunk permit vlan 100

[SwitchB-GigabitEthernet1/0/2] quit

4.     Configure Switch C:

# Create VLAN 100.

<SwitchC> system-view

[SwitchC] vlan 100

[SwitchC–vlan100] quit

# Configure GigabitEthernet 1/0/1 and GigabitEthernet 1/0/2 as trunk ports, and assign them to VLAN 100.

[SwitchC] interface gigabitethernet 1/0/1

[SwitchC-GigabitEthernet1/0/1] port link-type trunk

[SwitchC-GigabitEthernet1/0/1] port trunk permit vlan 100

[SwitchC-GigabitEthernet1/0/1] quit

[SwitchC] interface gigabitethernet 1/0/2

[SwitchC-GigabitEthernet1/0/2] port link-type trunk

[SwitchC-GigabitEthernet1/0/2] port trunk permit vlan 100

[SwitchC-GigabitEthernet1/0/2] quit

5.     Shut down GigabitEthernet 1/0/1 on Switch B to prevent loops.

[SwitchB] interface gigabitethernet 1/0/1

[SwitchB-GigabitEthernet1/0/1] shutdown

[SwitchB-GigabitEthernet1/0/1] quit

Verifying the configuration

# Verify that no loops exist.

[AP] display loopback-detection

Loopback-detection is enabled.

Loopback detection interval is 35 second(s).

No loopback is detected.

# Verify that loop detection is disabled on Switch A, Switch B, and Switch C.

[SwitchA] display loopback-detection

Loopback-detection is disabled.

[SwitchB] display loopback-detection

Loopback-detection is disabled.

[SwitchC] display loopback-detection

Loopback-detection is disabled.

# Bring up GigabitEthernet 1/0/1 on Switch B to create a loop. (Details not shown.)

# Verify that the AP has detected and removed a loop on the interface attached to the ring network.

%Feb 24 15:04:29:663 2013 AP LPDT/4/LPDT_LOOPED: Loopback exists on GigabitEthernet1/0/1.

%Feb 24 15:04:44:243 2013 AP LPDT/4/LPDT_RECOVERED: Loopback on GigabitEthernet1/0/1 recovered.

[AP] display loopback-detection

Loopback-detection is enabled.

Loopback detection interval is 35 second(s).

Loopback is detected on following interfaces:

Interface                Action mode

GigabitEthernet1/0/1     Shutdown