Unidirectional Link Detection (UDLD)
Last Updated: [last-modified] (UTC)
Unidirectional links are more common with fibre, but may also happen with copper
Imagine that you have a dual-core fibre run between two buildings. Somewhere along the run, one of the cores gets damaged. This may leave you in a position where you have a uni-directional link. You have enough of a link to send in one direction, but not the other.
Devices at each end may have trouble noticing the link impairment. Traffic still flows, in one direction at least, so they may think the link is still up.
But that’s better than a completely severed link right? Maybe not. Spanning-tree may allow some layer-2 loops through the network. Why? It is unable to send BPDU’s to a connected switch. One way to protect against this specific problem is Loop Guard. If a port expects BPDU’s, but does not receive them, Loop Guard disables the port.
But how do we protect against other problems? This is when you use Unidirectional Link Detection, or UDLD. Cisco designed the UDLD protocol, but it was later adapted to an industry standard in RFC 5171. Two devices with UDLD will send each other hello packets every 15 seconds. If the responses are missing, the switch disabled the port.
Recommendation: Use aggressive mode
Enable UDLD globally or per interface. It can also be set to enable or aggressive mode. Enable mode will take no action other than to generate syslog messages. Aggressive mode will try to reestablish the link. If it is unable to, it will disable the port. The recommendation is to enable UDLD globally, in aggressive mode. Syslog messages are too easy to miss.
Configuration
Turn on UDLD per interface on with the udld port or udld port aggressive command. The modes do not need to match at both ends.
SW-1(config)#interface GigabitEthernet 0/1 SW-1(config-if)#udld port SW-2(config)#int GigabitEthernet 0/1 SW-2(config-if)#udld port aggressive ! Alternatively, use 'udld enable' or 'udld aggressive' to enable it globally
When it is first enabled, it passes through an unknown state. This prevents it from assuming that the link is down until it is able to get an initial response from it’s partner.
Once it is getting responses, it transitions into the bidirectional state.
SW-1#show udld Interface Gi0/0 --- Port enable administrative configuration setting: Disabled Port enable operational state: Disabled Current bidirectional state: Unknown Interface Gi0/1 --- Port enable administrative configuration setting: Enabled Port enable operational state: Enabled Current bidirectional state: Bidirectional Current operational state: Advertisement - Single neighbor detected Message interval: 15000 ms Time out interval: 5000 ms Port fast-hello configuration setting: Disabled Port fast-hello interval: 0 ms Port fast-hello operational state: Disabled Neighbor fast-hello configuration setting: Disabled Neighbor fast-hello interval: Unknown Entry 1 --- Expiration time: 43800 ms Cache Device index: 1 Current neighbor state: Bidirectional Device ID: 91I51YKW0UB Port ID: Gi0/1 Neighbor echo 1 device: 9MJM4TSXVT7 Neighbor echo 1 port: Gi0/1 TLV Message interval: 15 sec No TLV fast-hello interval TLV Time out interval: 5 TLV CDP Device name: SW-2 Interface Gi0/2 --- Port enable administrative configuration setting: Disabled Port enable operational state: Disabled Current bidirectional state: Unknown SW-2#show udld gigabitEthernet 0/1 Interface Gi0/1 --- 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 Time out interval: 5000 ms Port fast-hello configuration setting: Disabled Port fast-hello interval: 0 ms Port fast-hello operational state: Disabled Neighbor fast-hello configuration setting: Disabled Neighbor fast-hello interval: Unknown Entry 1 --- Expiration time: 32100 ms Cache Device index: 1 Current neighbor state: Bidirectional Device ID: 9MJM4TSXVT7 Port ID: Gi0/1 Neighbor echo 1 device: 91I51YKW0UB Neighbor echo 1 port: Gi0/1 TLV Message interval: 15 sec No TLV fast-hello interval TLV Time out interval: 5 TLV CDP Device name: SW-1
References
Packet Life – UDLD