Vous êtes sur la page 1sur 7

UDLD - Packet Life

http://packetlife.net/blog/2011/mar/7/udld/ Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

UDLD
By stretch | Monday, March 7, 2011 at 3:49 a.m. UTC

Unidirectional Link Detection (UDLD) is a Cisco-proprietary layer two protocol devised to automatically detect the loss of bidirectional communication on a link. It is often mentioned in discussion of spanning tree, but has no direct relation to IEEE 802.1D. UDLD can be run on both fiber optic and twisted-pair copper links. Although UDLD is a proprietary protocol, its operation and packet format are defined in RFC 5171. The benefit of enabling UDLD on fiber interfaces is obvious. Fiber employs light to carry data, which does not require a looped path to complete a circuit as does an electrical medium like twisted-pair Ethernet (wherein each pair in the cable is a physical circuit). As such, it is possible for the link to fail in only one direction.

UDLD is intended to detect such a condition. UDLD can also be just as useful on copper links traversing intermediate "dumb" devices, such as media converters.

In the above example, the endpoint at left cannot tell that the distant media converter has failed, as its link to the local media converter remains up (of course, this behavior is dependent on the media converter). UDLD is able to detect the far end failure by the lack of incoming UDLD advertisements from the neighboring device.

Configuration
By default, UDLD is disabled on all interfaces. We can enable UDLD globally on the device, or individually on specific interfaces with the command udld port. This enables UDLD in normal mode.

Switch(config)# interface f0/13 Switch(config-if)# udld port

It would be prohibitively difficult to coordinate the configuration of UDLD on both ends of a link at the same time, so when

1 of 7

3/10/2011 1:24 AM

UDLD - Packet Life

http://packetlife.net/blog/2011/mar/7/udld/ Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

UDLD is first enabled and does not detect a neighbor the link state is considered unknown, which is not necessarily an error condition.

Switch# show udld f0/13 Interface Fa0/13 --Port enable administrative configuration setting: Enabled Port enable operational state: Enabled Current bidirectional state: Unknown Current operational state: Advertisement Message interval: 7 Time out interval: 5 No neighbor cache information stored

After enabling UDLD on the connected interface of the other switch, we can see that the local switch has detected its neighbor and updated the link's status to bidirectional.

Switch# show udld f0/13 Interface Fa0/13 --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 Entry 1 --Expiration time: 40 Device ID: 1 Current neighbor state: Bidirectional Device name: CAT0746Z0WN Port ID: Fa0/16 Neighbor echo 1 device: CAT1032NJ69 Neighbor echo 1 port: Fa0/13 Message interval: 15 Time out interval: 5 CDP Device name: S2

UDLD is capable of tracking multiple neighbors per interface, but this isn't typically necessary in the real world. We can simulate an error on the far end of the link to see how UDLD responds. Using the default values for the advertisement timer (15 seconds) and hold timer (5 seconds), UDLD can take up to 20 seconds to respond to an error.

2 of 7

3/10/2011 1:24 AM

UDLD - Packet Life

http://packetlife.net/blog/2011/mar/7/udld/ Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Switch# debug udld events UDLD events debugging is on Switch# 00:18:07: allNeighborsAgedOutEvent during link up. (Fa0/13) 00:18:07: Phase set from ADV to LUP because all neighbors aged out (Fa0/13) 00:18:07: prev = 0 entry = 3790AEC next = 0 exp_time = 0 (Fa0/13) 00:18:07: udsb->cache = 0x2F80128 (Fa0/13) 00:18:07: timeout timer = 7 (Fa0/13) 00:18:08: timeout timer = 6 (Fa0/13) 00:18:09: timeout timer = 5 (Fa0/13) 00:18:10: timeout timer = 4 (Fa0/13) 00:18:11: timeout timer = 3 (Fa0/13) 00:18:12: timeout timer = 2 (Fa0/13) 00:18:13: timeout timer = 1 (Fa0/13) 00:18:14: timeout timer = 0 (Fa0/13) 00:18:14: Phase set to udld_advertisement from phase udld_link_up. (Fa0/13) 00:18:14: Phase set to udld_advertisement after timer_expired. (Fa0/13) Switch# show udld f0/13 Interface Fa0/13 --Port enable administrative configuration setting: Enabled Port enable operational state: Enabled Current bidirectional state: Unknown Current operational state: Advertisement Message interval: 7 Time out interval: 5 No neighbor cache information stored

As evidenced by the debugging output above, upon detecting the loss of a neighbor, UDLD will send seven additional advertisements (one per second). If still no reply is received, the link's bidirectional status transitions to unknown. Of course, that isn't terribly helpful: the interface is still considered operational by upper-layer protocols and the switch may still be attempting to send traffic to the distant end. As an alternative to normal mode, we can configure UDLD in aggressive mode. Aggressive mode differs in that, if a link is detected as being unidirectional, the interface is placed into the errordisabled state and ceases sending traffic. This state is much more visible to administrators as a problem. To enable UDLD in aggressive mode, simply append the argument aggressive to the earlier configuration command. When enabling aggressive mode, it should be enabled on both ends of the link.

Switch(config)# interface f0/13 Switch(config-if)# udld port aggressive

We can verify that UDLD is now operating in aggressive mode:

3 of 7

3/10/2011 1:24 AM

UDLD - Packet Life

http://packetlife.net/blog/2011/mar/7/udld/ Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Switch# show udld f0/13 Interface Fa0/13 --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: 7 Time out interval: 5 Entry 1 --Expiration time: 43 Device ID: 1 Current neighbor state: Bidirectional Device name: CAT0746Z0WN Port ID: Fa0/16 Neighbor echo 1 device: CAT1032NJ69 Neighbor echo 1 port: Fa0/13 Message interval: 15 Time out interval: 5 CDP Device name: S2

After again simulating a failure at the far end, we can see that now UDLD responds by placing the local interface into the error-disabled state.

Switch# show udld f0/13 Interface Fa0/13 --Port enable administrative configuration setting: Enabled / in aggressive mode Port enable operational state: Enabled / in aggressive mode Current bidirectional state: Unknown Current operational state: Disabled port Message interval: 7 Time out interval: 5 No neighbor cache information stored Switch# show interfaces f0/13 FastEthernet0/13 is down, line protocol is down (err-disabled) Hardware is Fast Ethernet, address is 0018.ba98.688f (bia 0018.ba98.688f) MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) ...

After resolving the error condition, we can restore the interface to normal operation either by administratively taking it down and then back up (shutdown, no shutdown), or by issuing the global command udld reset to automatically restore all interfaces placed in the error-disabled state by a UDLD failure.

Switch# udld reset 1 ports shutdown by UDLD were reset.

4 of 7

3/10/2011 1:24 AM

UDLD - Packet Life

http://packetlife.net/blog/2011/mar/7/udld/ Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Finally, you can check out this packet capture to see what UDLD looks like on the wire.

About the Author


Jeremy Stretch is a freelance networking engineer, instructor, and the maintainer of PacketLife.net. He currently lives in Fairfax, Virginia, on the edge of the Washington, DC metro area. Although primarily an R&S guy, he likes to get into everything, and runs a free Cisco lab out of his basement for fun. You can contact him by email or follow him on Twitter.

Posted in Switching

Comments
Aki (guest) commented on Monday, March 7, 2011 at 9:48 a.m. UTC

Nice article, thumbs up!

yeled commented on Monday, March 7, 2011 at 12:15 p.m. UTC

If you're looking for UDLD interoperability other vendors, Juniper has a KB with a lateral (and neat) workaround: Use LACP in a single member LAG. http://kb.juniper.net/InfoCenter/index?page=content&id=KB13314

@My_Bits (guest) commented on Monday, March 7, 2011 at 1:54 p.m. UTC

UDLD Aggressive inteoperates with UDLD Normal on the other side of a link. This type of configuration means that just one side of the link will be errdisabled once Unidirectional condition has been detected. Link: http://blog.ine.com/2008/07/05/udld-modes-of-operation/

stretch commented on Monday, March 7, 2011 at 4:04 p.m. UTC

@My_Bits: Although the two modes will inter-operate, a unidirectional link would

5 of 7

3/10/2011 1:24 AM

UDLD - Packet Life

http://packetlife.net/blog/2011/mar/7/udld/ Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.
result in a different error condition on either end. Running the same mode on both ends ensures consistent behavior and is recommended by Cisco (see "Configuration Guidelines").

CJ (guest) commented on Monday, March 7, 2011 at 7:01 p.m. UTC

Great explanation. It really helped me understand UDLD better. It also peeked my interest in it.

xzatech commented on Tuesday, March 8, 2011 at 4:09 a.m. UTC

That was a solid piece. A subject that has come up before. Your explanation has helped me.

Killian (guest) commented on Tuesday, March 8, 2011 at 7:00 a.m. UTC

Another great post Jeremy. May want to look at recovery from the errdisable to happen automatically. errdisable recovery cause udld errdisable recovery interval 30 Helps for remote devices, though a routing protocol would be preferred.

Venkat (guest) commented on Tuesday, March 8, 2011 at 11:50 a.m. UTC

short and precise. Thanks!!

seandickson (guest) commented on Tuesday, March 8, 2011 at 12:58 p.m. UTC

Is UDLD suitable to detect a failure in MetroE circuits? We frequently have issues where a circuit is down but still shows up since they are connected to intermediate switches.

6 of 7

3/10/2011 1:24 AM

UDLD - Packet Life

http://packetlife.net/blog/2011/mar/7/udld/ Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.
gsulbaran commented on Wednesday, March 9, 2011 at 12:56 a.m. UTC

Hi Stretch, Could you explain de differences between UDLD and spanning-tree loop guard, it seem to be very similar and use for the same purpose. Sorry if the wording is not very good but I'm from Venezuela and my English is not very good.

Leave a Comment

7 of 7

3/10/2011 1:24 AM

Vous aimerez peut-être aussi