Content

| 4.3 |  | Troubleshooting Switched Ethernet Networks |
| 4.3.3 |  | Preventing STP loops |

In order to detect the unidirectional links before the forwarding loop is created, Cisco designed and implemented the UDLD protocol.

UDLD is a Layer 2 protocol that works with the Layer 1 mechanisms to determine the physical status of a link. At Layer 1, autonegotiation takes care of physical signaling and fault detection. UDLD performs tasks that autonegotiation cannot perform, such as detecting the identities of neighbors and shutting down misconnected ports. When UDLD is enabled, it works with autonegotiation to prevent physical and logical unidirectional connections from forming and causing other protocols to malfunction.

UDLD works by exchanging protocol packets between the neighboring devices. In order for UDLD to work, both devices on the link must support UDLD and have it enabled on respective ports.

Each switch port configured for UDLD will send UDLD protocol packets containing the port's own device/port ID, and the neighbor's device/port IDs seen by UDLD on that port. Neighboring ports should see their own device/port ID (echo) in the packets received from the other side.

If the port does not see its own device/port ID in the incoming UDLD packets for a specific duration of time, the link is considered unidirectional. This echo-algorithm allows detection of several issues:

- Link is up on both sides, but packets only received by one side.
- Wiring mistakes, when receive and transmit fibers are not connected to the same port on the remote side.

Once the unidirectional link is detected by UDLD, the respective port is disabled and the following message is printed on the console:

> UDLD-3-DISABLE: Unidirectional link detected on port 1/2. Port disabled

Port shutdown by UDLD remains disabled until it is manually reenabled, or until errdisable timeout expires if configured.

The following commands detail configuring UDLD on Catalyst switches running Cisco IOS. By default, UDLD is disabled. First, UDLD needs to be enabled globally by issuing the following command:

> Switch(config)#udld enable

By default, this command will enable UDLD on all interfaces.

UDLD can be enabled on a specific interface by issuing the following command:

> Switch(config-if)#udld enable

The interface command overrides the global configuration command. UDLD can be verified with the following command:

> Switch#show udld interface

See Figure for an example of the output produced.

Should it be necessary to override the UDLD configuration on individual interfaces, this can be accomplished from the interface configuration mode:

> Switch(config)#interface fastethernet 0/12
> Switch(config-if)#udld enable

In an environment that supports UDLD, enabling this functionality has the potential to prevent STP loops and the loss of network connectivity that results. Cisco recommends that UDLD should be enabled wherever possible.