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
- 1. Each side announces itself. SW1 sends UDLD frames with its device name and port.
- 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. Now one strand fails. The SW2 → SW1 direction breaks. SW1's frames still reach SW2…
- 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 frames | Likely cause |
|---|---|
| The neighbour's frames don't list my switch and port | The neighbour can't hear me: one strand is broken |
| The reply names a different port than the one I'm on | Wrong cabling: the send and receive strands go to different ports |
| I see my own device and port in received frames | The port is looped back to itself |
| No frames at all, though the link is up | A 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
| Setting | Default | Notes |
|---|---|---|
| Message interval | 15 s | Change it to 7–90 s with udld message time |
| Time to declare a neighbour lost | ≈ 3 × interval ≈ 45 s | A shorter interval finds problems faster |
| Aggressive retry | 1 frame/s for 8 s | Then the port is err-disabled |
Normal vs. aggressive mode
| Mode | When it finds a problem | When UDLD messages just stop |
|---|---|---|
| Normal | Acts only when it is sure the link is one-way or wired wrongly | Marks the port "undetermined" and logs it. The port stays up. |
| Aggressive | Shuts 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 enableFor the whole switch: normal mode on all fibre ports.
udld aggressiveFor the whole switch: aggressive mode on all fibre ports.
interface GigabitEthernet1/0/49
udld port aggressiveOn one interface. This also works on copper ports, if you want it there.
Verify and recover
show udld neighborsShows each UDLD neighbour, its port, and the link state (Bidirectional when it's working).
show udld GigabitEthernet1/0/49Shows the mode, the state and the current two-way status for one port.
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
%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
show interfaces status err-disabled shows the reason as udld.udld resetTurns 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
How does UDLD know a link is unidirectional?
UDLD messages stop arriving on a port in normal mode. What happens?