Configuring UDLD and Loop Guard

To enable or disable UDLD and loop guard, use these commands:  – 

Configuring UDLD
UDLD is used when a link should be shut down because of a hardware failure that is causing unidirectional communication. In an EtherChannel bundle, UDLD will shut down only the physical link that has failed.

UDLD can be enabled globally for all fiber interfaces or on a per interface basis.

Enable UDLD on an Interface
To enable UDLD on an interface use the following command:

Switch(config-if)#udld enable

Enable UDLD Globally
To enable UDLD globally on all fiber-optic interfaces, use the following command:

Switch(config)#udld enable

Verify and Resetting UDLD

Interfaces will be shut down by UDLD. To reset all interfaces that have been shut down by UDLD, enter this command:

Switch#udld reset

To verify the UDLD configuration for an interface, enter this command:

Switch#show udld interface

Example: Displaying the UDLD State
This example shows how to display the UDLD state for a single interface.

Switch#show udld GigabitEthernet2/2

Configuring Loop Guard
Loop guard is enabled on a per-port basis. When loop guard is enabled, it is automatically applied to all of the active VLAN instances to which that port belongs. When you disable loop guard, it is disabled for the specified ports. Disabling loop guard moves all loop-inconsistent ports to the listening state. If loop guard is enabled on an EtherChannel interface, the entire channel will be blocked for a particular VLAN. This is because EtherChannel is regarded as one logical port from an STP point of view.

Loop guard should be enabled on the root port and the alternate ports on access switches.

Enable Loop Guard on an Interface
To enable loop guard on a specific interface, issue this command:

Switch(config)#spantree guard loop mod/port

To disable loop guard, issue this command:

Switch(config)#spantree guard none mod/port

Enabling loop guard will disable root guard, if root guard is currently enabled on the ports.

Enable Loop Guard Globally
Loop guard can be enabled globally on a switch for all point-to-point links. A full-duplex link is considered to be a point-to-point link. The status of loop guard can be changed on an interface even if the feature has been enabled globally.

To enable loop guard globally, issue this command:

Switch(config)#spantree global-default loopguard enable

To globally disable loop guard, issue this command:

Switch(config)#spantree global-default loopguard disable

Verifying the Loop Guard Status
To verify the loop guard status, issue this command:

Switch#show spantree guard mod/port | vlan

For example:

Switch#show spantree guard 3/13
Port VLAN Port-State Guard Type
------- ------- ------------------- ----------------
3/13 2 forwarding loop
Lab Activity

Lab Exercise: Port Level Tuning to Control STP Behavior

The purpose of this lab is to use PortFast, UplinkFast, BPDU guard, root guard, and UDLD to control STP behavior on a port.

Spanning-Tree Protocol Enhancements using loop guard and BPDU Skew Detection Features