Course contents

Chapter 6: Spanning Tree ProtocolLesson 23 of 25

Beyond CCNA (optional). This topic is not on the CCNA 200-301 exam. It is useful at work and in later study; skip it if you are preparing for the exam. (UDLD is not in the exam topics; Layer 2 discovery there is CDP and LLDP.)

Unidirectional Link Detection (UDLD)

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

Advanced · 6 min read

Technical definition

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.

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 shows how). UDLD (Unidirectional Link Detection) is a Cisco protocol. It checks directly that both directions work.

Each switch listens for its own name

Diagram
UDLD detecting a unidirectional fibre link
UDLD detecting a unidirectional fibre link
fibre pairSW1Gi1/0/49SW2Gi1/0/49

Device key: SW1, SW2 (switch)

Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type. Blocked: forwarding prevented by a port or policy. Down: failed link. Read the step for the cause.

  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

Diagram
What UDLD can catch
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)
Each item on the left, with what it means on the right.

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.

UDLD timers

Diagram
UDLD timers
UDLD timers
SettingDefaultNotes
Message interval15 sChange it with udld message time (range depends on the platform, up to 90 s)
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
Read each row across: the left box names the item, the others describe it.

Normal vs. aggressive mode

Diagram
Normal vs. aggressive mode
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
Read each row across: the left box names the item, the others describe it.

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.

Turning UDLD on, globally or per port

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.

Reading show udld and bringing a port back

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.)

Before replacing anything, clean and reseat the optics. In practice, a one-way fibre is often a dirty or half-seated connector rather than a broken strand.

Lab tip: to test it without breaking a fibre, on some platforms you can add a MAC access list on one switch that blocks incoming frames to 0100.0ccc.cccc (many switches send these control frames straight to the CPU, so check the platform guide). That switch then 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.

Test yourself on UDLD

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?