How to configure UDLD Protocol in Cisco Switches [Complete Tutorial]


This article is a step-by-step guide on how to configure UDLD protocol in Cisco switches. Switches are network devices used to connect hosts in a network. Switches forward data packets between these devices using a technique known as packet switching. UDLD which stands for Unidirectional Link Detection is a layer two is a lightweight protocol that can be used to detect and disable one-way connections before they create dangerous situations such as Spanning Tree loops or other protocol malfunctions.. It was developed by Cisco to solve the issues arises due to mis-wirings and hardware faults which led to disruption in communication path.


What is UDLD Protocol ?

A Cisco proprietary protocol, UDLD is a protocol that enables switches to automatically detect when a bi-directional link, due to link failure or improper port connection, becomes unidirectional.

Usually, for switches to forward and receive data packets between source and destination, links need to be bi-directional. This ensures dual communication. However, fiber optics connections are prone to having undetected unidirectional link failures because they do not depend on looped paths to transmit data like other mediums.

Even in electrical mediums like twisted pair cables, unidirectional link failures can still occur and go unnoticed to the endpoints. The presence of unidirectional links can lead to a multitude of problems which include forwarding and spanning tree loops that can lead to network outages.


How does UDLD Protocol Works ?

To use the UDLD protocol all connected switches and interfaces have to be configured for it. A UDLD configured switch sends UDLD advertisements, "hello" packets to its neighbors and expects to receive one in the designated hold time (the default hold time is 15mins). If this doesn't happen the UDLD disables the unresponsive interface.


Modes of the UDLD Protocol

There are two modes in which UDLD protocol can be configured - the normal mode and the aggressive mode. An interface marked as having a bi-directional link state but failing to send a UDLD response will be flagged as undetermined by the UDLD protocol in the normal mode.

Conversely, in the aggressive mode, when the protocol tries to reestablish a link and there is no response, it places the interface in an error-disabled state. The difference between the later and the normal mode is that - the upper layers still see the unidirectional link as active in the normal mode and will send packets to it. But in the aggressive mode that is avoided.



Lab Setup

Our Lab setup includes below network components:-

  • Three Layer-2 Switches and
  • Connecting cables


How to configure UDLD Protocol in Cisco Switches [Complete Tutorial]

How to configure UDLD Protocol in Cisco Switches [Complete Tutorial]

Also Read: How to Configure EIGRP on Cisco Routers [Complete Tutorial]

To illustrate how to configure UDLD in individual interfaces we will be using a basic setup. We aim to configure the interfaces of the switches to enable UDLD protocol first in the normal mode and then the aggressive mode. Then, we will verify our connections and configuration to make sure everything works fine.


Step 1: Set up the Network

Switches do not come with the UDLD protocol enabled so we have to do the configuration manually. The first step is to set up the network.

How to configure UDLD Protocol in Cisco Switches [Complete Tutorial] 2

Switch 1 has two interfaces that we will make use of - GigabitEthernet0/0/0 and GigabitEthernet0/0/1

  • Connect its GigabitEthernet0/0/1 to the GigabitEthernet0/0/0 of switch 2.
  • Connect its GigabitEthernet0/0/2 to the GigabitEthernet0/0/0 of switch 3.

Then we will do the same for the other two switches.


Step 2: Configure UDLD Protocol

After setting up the network above, the next step is to set up the UDLD protocol using a special set of commands.

UDLD protocol commands:-

  • Turn on udld in normal mode - udld port
  • Turn on udld aggressive mode - udld aggressive

We will be using these commands for all the switches in the network.

a) Switch 1

Enter the interface config mode and apply the udld command:-

Switch1> enable
Switch1# configure terminal

This will take you into global configuration mode.

Switch1(config)# interface gigabitethernet0/0/1
Switch1(config-if)# udld port
Switch1(config-if)# end

Do the same thing for the interface GigabitEthernet0/0/2 of switch 1.

Switch1(config)# interface gigabitethernet0/0/2
Switch1(config-if)# udld port
Switch1(config-if)# end

That will set up UDLD for Switch 1. After which we will repeat the above for Switch 2 and Switch 3.

b) Switch 2

Similarly, login to Switch 2 and enter below command.

Switch2> enable
Switch2# configure terminal

This will take you into global configuration mode.

Switch2(config)# interface gigabitethernet0/0/0 
Switch2(config-if)# udld port 
Switch2(config-if)# end

c) Switch 3

Finally login to switch 3 and enter below command.

Switch3> enable
Switch3# configure terminal

This will take you into global configuration mode.

Switch3(config)# interface gigabitethernet0/0/0
Switch3(config-if)# udld port 
Switch3(config-if)# end


Step 3: Verify the configuration state

Now, after enabling the protocol in the procedure above, it's time to find out if we did it successfully and if our switches can now operate using the UDLD protocol, we can do this by using various commands.

UDLD verification command:-

  • show udld interface-id

In Switch1's interface type in the show udld command:-

Switch1# show udld gigabitethernet0/0/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: 15
Time out interval: 5

The message above indicates that the protocol is enabled. Now, try this for Switch2's interfaces. With the UDLD protocol in place, the switches will detect the presence of a unidirectional link if there becomes one. But in this normal configuration, it will only mark it as undetermined with a notification. Other network layers can still try to interface with it. The solution to that problem is the aggressive mode.

So let's set up the switches to use aggressive mode instead. To change to aggressive mode all we need is to add one word to our original command - aggressive. So instead of using udld port, we will be using udld port aggressive for the aggressive mode configuration of the UDLD protocol.

For Switch1's GigabitEthernet 1/0/1 interfaces enter the following command:-

Switch1> enable
Switch1# configure terminal
Switch1(config)# interface gigabitethernet0/0/1
Switch1(config-if)# udld port aggressive
Switch1(config-if)# end

And there you have it. UDLD protocol aggressive mode. Now, when there's a unidirectional link, the protocol will mark it as error disabled instead of undetermined, stopping every traffic to it.



The UDLD protocol is important, especially for networks that use fiber optics or twisted pair cables. The protocol uses UDLD advertisements to detect dead links. Depending on the node it can either shut the link down or declare it undetermined. In this article, we have seen what is UDLD protocol and how to configure it on Cisco Switches.

Leave a Comment