STP loop guard

Spanning Tree (STP) is used to ensure a loop-free topology over the LAN. Occasionally a hardware or software failure can cause STP to fail, creating STP/forwarding loops that can cause network failures where unidirectional links are used. The non-designated port transitions in a faulty manner because the port is no longer receiving STP BPDUs.

STP Loop Guard causes the non-designated port to go into the STP loop inconsistent state instead of the forwarding state. In the loop-inconsistent state, the port prevents data traffic and BPDU transmission through the link, therefore avoiding the loop creation. When BPDUs again are received on the inconsistent port, it resumes normal STP operation automatically. STP loop guard is best applied on blocking or forwarding ports.

Loop creation with transmission failure

Syntax:

spanning-tree port-list loop-guard
no spanning-tree port-list loop-guard

Enables STP loop guard on a particular port or ports. The no form of the command disables STP loop guard.

Default: Disabled.

Enabling spanning tree loop guard on Port 2 and Viewing the port's status

switch(config)# spanning-tree 2 loop-guard
switch(config)# show spanning-tree

 Multiple Spanning Tree (MST) Information

  STP Enabled   : Yes
  Force Version : MSTP-operation
  IST Mapped VLANs : 1-4094
  Switch MAC Address : 0024a8-d13a40
  Switch Priority    : 32768
  Max Age  : 20
  Max Hops : 20
  Forward Delay : 15

  Topology Change Count  : 1
  Time Since Last Change : 20 mins

  CST Root MAC Address : 001083-847000
  CST Root Priority    : 0
  CST Root Path Cost   : 60000
  CST Root Port        : 1

  IST Regional Root MAC Address : 0024a8-d13a40
  IST Regional Root Priority    : 32768
  IST Regional Root Path Cost   : 0
  IST Remaining Hops            : 20

  Root Guard Ports     : 
  Loop Guard Ports     : 2
  TCN Guard Ports      : 
  BPDU Protected Ports : 
  BPDU Filtered Ports  : 
  PVST Protected Ports : 
  PVST Filtered Ports  :

                 |           Prio              | Designated    Hello
Port   Type      | Cost      rity State        | Bridge        Time PtP Edge
------ --------- + --------- ---- ------------ + ------------- ---- --- ----
1      100/1000T | 20000     128  Forwarding   | 001871-cdea00 2    Yes No
2      100/1000T | Auto      128  Inconsistent |
3      100/1000T | Auto      128  Disabled     |
4      100/1000T | Auto      128  Disabled     |
5      100/1000T | Auto      128  Disabled     |
6      100/1000T | Auto      128  Disabled     |
7      100/1000T | Auto      128  Disabled     |
8      100/1000T | Auto      128  Disabled     |

Viewing summary spanning tree configuration information

switch(config)# show spanning-tree config

 Multiple Spanning Tree (MST) Configuration Information

  STP Enabled [No] : Yes
  Force Version [MSTP-operation] : MSTP-operation
  Default Path Costs [802.1t] : 802.1t
  MST Configuration Name : 0024a8d13a40
  MST Configuration Revision : 0       Switch Priority : 32768
  Forward Delay [15] : 15              Hello Time [2] : 2
  Max Age [20] : 20                    Max Hops [20] : 20
  
               | Path      Prio Admin Auto Admin Hello  Root  Loop  TCN   BPDU
Port Type      | Cost      rity Edge  Edge PtP   Time   Guard Guard Guard Flt
---- --------- + --------- ---- ----- ---- ----- ------ ----- ----- ----- ---
1    100/1000T | Auto      128  No    Yes  True  Global No    No    No    No
2    100/1000T | Auto      128  No    Yes  True  Global No    Yes   No    No
3    100/1000T | Auto      128  No    Yes  True  Global No    No    No    No
4    100/1000T | Auto      128  No    Yes  True  Global No    No    No    No
5    100/1000T | Auto      128  No    Yes  True  Global No    No    No    No
6    100/1000T | Auto      128  No    Yes  True  Global No    No    No    No
.
.
.

Viewing detailed spanning tree configuration information

switch(config)# show spanning-tree detail

 Status and Counters - CST Port(s) Detailed Information
  Port                     : 1
  Status                   : Up
.
.
.

  Port                     : 2
  Status                   : Up
  BPDU Protection          : No
  BPDU Filtering           : No
  PVST Protection          : No
  PVST Filtering           : No
  Errant BPDU Count        : 0
  Root Guard               : No
  Loop Guard               : Yes
  TCN Guard                : No
  MST Region Boundary      : Yes
  External Path Cost       : 20000
  External Root Path Cost  : 40000
  Administrative Hello Time: Global
  Operational Hello Time   : 2
  AdminEdgePort            : No
  Auto Edge Port           : Yes
  OperEdgePort             : No
  AdminPointToPointMAC     : True
  OperPointToPointMAC      : Yes
  Aged BPDUs Count         : 0
  Loop-back BPDUs Count    : 0
  TC ACK Flag Transmitted  : 0
  TC ACK Flag Received     : 1

 MST        MST        CFG        CFG        TCN        TCN
 BPDUs Tx   BPDUs Rx   BPDUs Tx   BPDUs Rx   BPDUs Tx   BPDUs Rx
 ---------- ---------- ---------- ---------- ---------- ----------
 3          0          24354      1682       0          13

Viewing spanning tree configuration information for a single port

switch(config)# show spanning-tree 2

 Multiple Spanning Tree (MST) Information

  STP Enabled   : Yes
  Force Version : MSTP-operation
  IST Mapped VLANs : 1-4094
  Switch MAC Address : 0024a8-d13a40
  Switch Priority   : 32768
  Max Age : 20
  Max Hops : 20
  Forward Delay : 15

  Topology Change Count  : 1
  Time Since Last Change : 58 mins

  CST Root MAC Address : 001083-847000
  CST Root Priority   : 0
  CST Root Path Cost  : 60000
  CST Root Port       : 1

  IST Regional Root MAC Address : 0024a8-d13a40
  IST Regional Root Priority   : 32768
  IST Regional Root Path Cost  : 0
  IST Remaining Hops           : 20

  Root Guard Ports     : 
  Loop Guard Ports     : 2
  TCN Guard Ports      : 
  BPDU Protected Ports : 
  BPDU Filtered Ports  : 
  PVST Protected Ports : 
  PVST Filtered Ports  :

                 |           Prio              | Designated    Hello
Port   Type      | Cost      rity State        | Bridge        Time PtP Edge
------ --------- + --------- ---- ------------ + ------------- ---- --- ----
2      100/1000T | Auto      128  Inconsistent |