Cisco UDLD Configuration: Normal vs Aggressive Mode - 夜莺博客

Cisco UDLD Configuration: Normal vs Aggressive Mode

A unidirectional link - where one side receives traffic but the other does not - is one of the most dangerous failure modes in a switched network because it is invisible to Spanning Tree. The blocking port that should prevent the loop stops receiving BPDUs, ages out its STP information, and transitions to forwarding, creating a loop that fills the network with endlessly cycling frames. Cisco's Unidirectional Link Detection (UDLD) closes that gap by verifying at Layer 2 that neighbor identity is seen in both directions. This guide explains how UDLD works, the difference between normal and aggressive mode, and the configuration commands that protect fiber links.

Why STP Alone Is Not Enough

STP relies on receiving BPDUs. When a fiber pair fails in one direction only, the switch at the receiving end of the failed direction stops getting BPDUs while the link stays administratively up. After the maxAge timer (up to 20 seconds), the port moves from blocking to forwarding and a loop forms - exactly the scenario UDLD prevents.

How UDLD Works

UDLD is a Layer 2 protocol that works with Layer 1 auto-negotiation. Each port sends UDLD frames carrying the device and port IDs it sees; a port that stops seeing its own device/port ID echoed back from the neighbor concludes the link is unidirectional and disables the port:

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

UDLD also catches swapped fiber pairs - receive and transmit fibers connected to the wrong ports on the far side.

Normal vs Aggressive Mode

  • Normal mode: if UDLD information ages out while the port state was already determined bidirectional, no action is taken and the port is marked undetermined. Normal mode blocks only the one port that stopped hearing the neighbor.
  • Aggressive mode: if UDLD information ages out while the link is still up, the switch actively re-probes the neighbor; if the port cannot re-establish a bidirectional state, it is placed into errdisable. On a truly unidirectional fiber link, aggressive mode blocks both ends, which is what you want for point-to-point fiber.

Configuring UDLD Globally and Per Port

Enable UDLD on all fiber-optic ports from global configuration:

Switch(config)# udld enable

For aggressive mode on all fiber ports, or per port for copper/fiber point-to-point links:

Switch(config)# udld aggressive
Switch(config)# interface gigabitEthernet1/0/1
Switch(config-if)# udld port aggressive

Tuning the Message Interval

UDLD messages are sent every 15 seconds by default (range 1-90 seconds). A shorter interval detects faults faster but costs more protocol traffic; the hold time is dictated by the remote side's message interval:

Switch(config)# udld message time 10
UDLD message interval set to 10 seconds

Recovering Errdisabled Ports

When UDLD disables a port it stays down until you intervene. Re-enable it manually, or configure errdisable detection and auto-recovery:

Switch(config)# errdisable detect cause udld
Switch(config)# errdisable recovery cause udld
Switch(config)# errdisable recovery interval 300
Switch# clear errdisable interface gigabitEthernet1/0/1

Verifying UDLD

Switch# show udld gigabitEthernet1/0/1
Switch# show udld neighbors
Switch# show udld

The neighbor table should show a Bidirectional state; anything else means the fiber plant needs attention.

Related articles: RSTP vs MSTP explained, Cisco port security sticky MAC, and Layer 1 interface flapping troubleshooting.

原文链接:https://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/10591-77.html