Routelearn.net
Course menu

Course 6: Spanning Tree ProtocolLesson 4.7 (22 of 24 in this course)43 of 91 in the CCNA series

Unidirectional Link Detection (UDLD)

Detecting links that only work in one direction, before they cause a loop.

Advanced · 6 min read

UDLD (Unidirectional Link Detection) is a Cisco Layer 2 protocol that detects links on which traffic flows in only one direction, typically fibre links with a broken or miscabled strand. Each switch sends UDLD frames naming its device and port and expects the neighbour to echo them back; when that check fails, UDLD can put the port into the err-disabled state so the faulty link is not used.

In simple terms: A fibre link uses one strand to send and one to receive. If one strand fails, the link can still look up while traffic only goes one way. UDLD notices this and can shut the port before it causes problems such as a loop.

The problem STP can't see

A fibre link uses two strands: one to send and one to receive. If one strand breaks, or is plugged into the wrong port, the link can still show as up. But traffic only goes one way. STP needs BPDUs to go both ways, so a one-way link can cause a loop (the “Loop Guard” lesson). UDLD (Unidirectional Link Detection) is a Cisco protocol. It checks directly that both directions work.

How it works: echoes

fibre pairSW1Gi1/0/49SW2Gi1/0/49
  1. 1. Each side announces itself. SW1 sends UDLD frames with its device name and port.
  2. 2. The other side echoes it. SW2 replies with a list of the neighbours it hears. SW1 sees its own name in the list, so both directions work.
  3. 3. Now one strand fails. The SW2 → SW1 direction breaks. SW1's frames still reach SW2…
  4. 4. …but no echo comes back. SW1 never hears its own name sent back. In aggressive mode, it tries to reach SW2 again. If that fails, it shuts the port down (err-disabled).

What UDLD can catch

Clue in the UDLD framesLikely cause
The neighbour's frames don't list my switch and portThe neighbour can't hear me: one strand is broken
The reply names a different port than the one I'm onWrong cabling: the send and receive strands go to different ports
I see my own device and port in received framesThe port is looped back to itself
No frames at all, though the link is upA cut strand or a failing optic (aggressive mode acts on this)

UDLD frames go to the Cisco address 0100.0ccc.cccc. CDP, VTP, DTP and PAgP use the same address. UDLD is its own protocol, not part of STP. So it protects any protocol on the link, including routed OSPF links and EtherChannel links.

Timers

SettingDefaultNotes
Message interval15 sChange it to 7–90 s with udld message time
Time to declare a neighbour lost≈ 3 × interval ≈ 45 sA shorter interval finds problems faster
Aggressive retry1 frame/s for 8 sThen the port is err-disabled

Normal vs. aggressive mode

ModeWhen it finds a problemWhen UDLD messages just stop
NormalActs only when it is sure the link is one-way or wired wronglyMarks the port "undetermined" and logs it. The port stays up.
AggressiveShuts the port down (err-disabled)Tries to reach the neighbour again (about eight times), then shuts the port down

Aggressive mode gives stronger protection for fibre links between switches. The downside is that it shuts a link down if UDLD messages are lost. Both ends must run UDLD for it to work.

Configure

udld enable

For the whole switch: normal mode on all fibre ports.

udld aggressive

For the whole switch: aggressive mode on all fibre ports.

interface GigabitEthernet1/0/49 udld port aggressive

On one interface. This also works on copper ports, if you want it there.

Verify and recover

show udld neighbors

Shows each UDLD neighbour, its port, and the link state (Bidirectional when it's working).

show udld GigabitEthernet1/0/49

Shows the mode, the state and the current two-way status for one port.

Example output · based on Cisco documentation; exact format varies by platform and software version
SW1#show udld GigabitEthernet1/0/49
Interface Gi1/0/49
---
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: 15000 ms
    Entry 1
    ---
    Current neighbor state: Bidirectional
    Device name: SW2
    Port ID: Gi1/0/49
    Neighbor echo 1 port: Gi1/0/49
Bidirectional (both directions work) for the port and the neighbour. The neighbour also sends back the local port name. All is well.
Example output · based on Cisco documentation; exact format varies by platform and software version
%UDLD-4-UDLD_PORT_DISABLED: UDLD disabled interface Gi1/0/49, aggressive mode failure detected
%PM-4-ERR_DISABLE: udld error detected on Gi1/0/49, putting Gi1/0/49 in err-disable state
This is what a failure looks like. show interfaces status err-disabled shows the reason as udld.
udld reset

Turns back on ports that UDLD shut down, after the cable is fixed. (You can also use shutdown / no shutdown, or errdisable recovery cause udld.)

💡 Lab tip: to test it without breaking a fibre, add a MAC access list on one switch that blocks incoming frames to 0100.0ccc.cccc. That switch stops hearing UDLD. In aggressive mode, it shuts the port down.

UDLD and Loop Guard together

They do similar jobs, but they are not the same. UDLD checks the physical link directly, for each port. Loop Guard watches BPDUs, for each VLAN. Loop Guard also catches other problems, such as a switch that stops sending BPDUs because of a software fault. Many networks use both on links between switches.

Check yourself

Predict · scenario 1

How does UDLD know a link is unidirectional?

Predict · scenario 2

UDLD messages stop arriving on a port in normal mode. What happens?