Cisco Unidirectional Link Detection

Situations can arise where the transmit or receive side of a physical cable breaks or interface transceivers malfunction; one side is sending but the other side isn’t receiving. This situation is more common in fiber optic cabling where either the transmit or receive plug is mispatched, dirty, or breaks leading to unidirectional communication.

Spanning Tree relies on constant and consistant reception of BPDU messages from neighbor switches. If a switch stops receiving BPDUs on a designated port, STP ages out the information for the port and transitions it into forwarding state. This will ultimately lead to a unidirectional loop condition.

UDLD Loop Diagram

Cisco Unidirectional Link Detection

Unidirectional Link Detection, or UDLD, is one of many loop-prevention mechanisms available on Cisco switches to detect and stop unidirectional link failures. UDLD is a Cisco proprietary layer 2 protocol that uses UDLD messages as a heartbeat mechanism between switches on the same segment.

UDLD Messages

UDLD messages contain the local switch’s identity,port pair IDs, and a list of all neighbor switch/port pairs on the same segment. Using that information, UDLD can detect an explicit unidirectional link event if any of the following are seen:

  • Received UDLD messages do not exactly match the switch/port pair as those the switch is sending out. This could be due to something as simple as remote optical Tx and Rx connectors having been split up into different physical ports.
  • Received UDLD neighbor messages contain the same switch/port pair as the local switch. This suggests a cable looped into the same switch.
  • The local switch only knows of a single neighbor connected to the port, but the received UDLD messages contain more than one switch/port ID pair. This suggests a shared-media segment where the local switch cannot detect all neighbors on the link.

If any of the three conditions above present themselves, UDLD will err-disable the port – operationally shutting it down to contain the error condition.

UDLD Operational Modes

UDLD works by sending periodic UDLD messages, after which neighbors are expected to echo the packet back. If echo responses stop being received, it could mean a unidirectional link condition has occurred (as in the case of a cut Tx or Rx strand). This isn’t always the case however.

Consider the scenario of two switches directly connected using powered media converters in between. In this case, if one of the switches is powered off, the other switch’s interface will still stay up (due to the inline powered converters), but UDLD messages will stop being received. This is not a unidirectional link failure situation (one switch is just off) but as you will soon see, how UDLD responds to message disruptions depends on its UDLD mode.

UDLD has two modes of operation available, normal mode and aggressive mode. If any of the explicit unidirectional link failure scenarios outlined in the bullets above exist, UDLD err-disables the port, regardless of mode. By placing the port in err-disables state, UDLD effectively disables the port – preventing a potential unidirectional loop scenario.

The difference between normal and aggressive modes is how they respond when UDLD messages suddenly stop being received.

UDLD Normal Mode

Under normal mode, if incoming UDLD messages stop being received the switch tries to reconnect with its neighbor 8 times. If it is unable to reconnect, UDLD takes no action other than logging a message to syslog. The port stays up.

UDLD Aggressive Mode

Under aggressive mode, if incoming UDLD messages stop being received the switch tries to reconnect with its neighbor 8 times. If it is unable to reconnect, UDLD err-disables the port. This operationally disables the port and assumes a unidirectional link failure has occurred.

If aggressive mode err-disables the port if no response is received, then what happens when you first configure the link? I don’t know about you, but I often can’t configure two interfaces on two switches before UDLD in aggressive mode would timeout! UDLD accommodates for the first-time configuration by initially sending UDLD frames out the port, but not err-disabling the interface until it first hears an echo response from the remote switch. At that point if the switch stopped receiving UDLD echos, the port would be shut down.

UDLD Configuration

UDLD can be applied globally using the udld enable command or on a per-port basis using the udld port interface-level command.

UDLD Global Configuration

Since UDLD requires an echo response from neighbor switches, UDLD must be enabled on both ends of a link to operate successfully. When UDLD is activated at the global level of a switch, it only applies to fiber ports by default. Using the enable option activates normal mode; using the aggressive option activates (you guessed it) aggressive mode.

SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#udld ?
aggressive Enable UDLD protocol in aggressive mode on fiber ports except
where locally configured
enable Enable UDLD protocol on fiber ports except where locally
message Set UDLD message parameters

SW1(config)#udld enable

UDLD Interface-Level Configuration

UDLD normal mode is enabled on an interface using the udld port command. Aggressive mode requires the aggressive keyword added. Unlike global mode, when UDLD is activated at the interface-level it enables UDLD on the port regardless of media type.

SW1(config)#interface gig 1/0/10
SW1(config-if)#udld port ?
aggressive Enable UDLD protocol in aggressive mode on this interface

SW1(config-if)#udld port aggressive


The show udld and show udld neighbors commands can be used to verify UDLD operation locally and between neighbors.

SW1#show udld gigabitEthernet 1/0/10

Interface Gi1/0/10

Port enable administrative configuration setting: Enabled / in aggressive mode
Port enable operational state: Enabled / in aggressive mode
Current bidirectional state: Bidirectional
Current operational state: Advertisement – Single neighbor detected
Message interval: 7000
Time out interval: 5000

Entry 1

Expiration time: 44000
Device ID: 1
Current neighbor state: Bidirectional
Device name: FDO1323R1YN
Port ID: Gi1/0/10
Neighbor echo 1 device: FDO1323R1XN
Neighbor echo 1 port: Gi1/0/10

Message interval: 15
Time out interval: 5
CDP Device name: SW2.Lab

SW1#show udld neighbors
Port Device Name Device ID Port ID Neighbor State
—- ———– ——— ——- ————–
Gi1/0/10 FDO1323R1YN 1 Gi1/0/10 Bidirectional

Author Aaron

Aaron knows networks. He's been involved in building and supporting world-class data networks for the past 10 years - from international cloud service providers to Fortune 50 data centers. Aaron consults independently and is focused on building the best training platform available.

More posts by Aaron

Leave a Reply