Configuring STP Extensions

Information About STP Extensions

About STP Extensions

Cisco has added extensions to Spanning Tree Protocol (STP) that make convergence more efficient. In some cases, even though similar functionality may be incorporated into the IEEE 802.1w Rapid Spanning Tree Protocol (RSTP) standard, we recommend using these extensions. All of these extensions can be used with both RPVST+ and Multiple Spanning Tree Protocol (MST).

The available extensions are spanning tree port types, Bridge Assurance, BPDU Guard, BPDU Filtering, Loop Guard, and Root Guard. Many of these features can be applied either globally or on specified interfaces.


Note


Spanning tree is used to refer to IEEE 802.1w and IEEE 802.1s. If the text is discussing the IEEE 802.1D Spanning Tree Protocol, 802.1D is stated specifically.


Understanding STP Port Types

You can configure a spanning tree port as an edge port, a network port, or a normal port. A port can be in only one of these states at a given time. The default spanning tree port type is normal. Depending on the type of device to which the interface is connected, you can configure a spanning tree port as one of these port types.

Spanning Tree Edge Ports

Edge ports, which are connected to hosts, can be either an access port or a trunk port. The edge port interface immediately transitions to the forwarding state, without moving through the blocking or learning states. (This immediate transition was previously configured as the Cisco-proprietary feature PortFast.)

Interfaces that are connected to hosts should not receive STP bridge protocol data units (BPDUs).


Note


If you configure a port connected to another switch as an edge port, you might create a bridging loop.


Spanning Tree Network Ports

Network ports are connected only to switches or bridges. Configuring a port as a network port while Bridge Assurance is enabled globally, enables Bridge Assurance on that port.


Note


If you mistakenly configure ports that are connected to hosts or other edge devices as spanning tree network ports, those ports automatically move into the blocking state.


Spanning Tree Normal Ports

Normal ports can be connected to either hosts, switches, or bridges. These ports function as normal spanning tree ports.

The default spanning tree interface is a normal port.

Understanding Bridge Assurance

You can use Bridge Assurance to protect against certain problems that can cause bridging loops in the network. Specifically, you use Bridge Assurance to protect against a unidirectional link failure and a device that continues to forward data traffic when it is no longer running the spanning tree algorithm.


Note


Bridge Assurance is supported only by Rapid PVST+ and MST. Legacy 802.1D spanning tree does not support Bridge Assurance.


Bridge Assurance is enabled by default and can only be disabled globally. Also, Bridge Assurance can be enabled only on spanning tree network ports that are point-to-point links. Finally, both ends of the link must have Bridge Assurance enabled.

With Bridge Assurance enabled, BPDUs are sent out on all operational network ports, including alternate and backup ports, for each hello time period. If the port does not receive a BPDU for a specified period, the port moves into the blocking state and is not used in the root port calculation. Once that port receives a BPDU, it resumes the normal spanning tree transitions.

Understanding BPDU Guard

Enabling BPDU Guard shuts down that interface if a BPDU is received.

You can configure BPDU Guard at the interface level. When configured at the interface level, BPDU Guard shuts the port down as soon as the port receives a BPDU, regardless of the port type configuration.

When you configure BPDU Guard globally, it is effective only on operational spanning tree edge ports. In a valid configuration, LAN edge interfaces do not receive BPDUs. A BPDU that is received by an edge LAN interface signals an invalid configuration, such as the connection of an unauthorized host or switch. BPDU Guard, when enabled globally, shuts down all spanning tree edge ports when they receive a BPDU.


Note


On the edge trunk interface level, if the remote side of the disabled VLAN is configured as an access port then the BPDUs will be ignored.


BPDU Guard provides a secure response to invalid configurations, because you must manually put the LAN interface back in service after an invalid configuration.


Note


When enabled globally, BPDU Guard applies to all operational spanning tree edge interfaces.


Understanding BPDU Filtering

You can use BPDU Filtering to prevent the switch from sending or even receiving BPDUs on specified ports.

When configured globally, BPDU Filtering applies to all operational spanning tree edge ports. You should connect edge ports only to hosts, which typically drop BPDUs. If an operational spanning tree edge port receives a BPDU, it immediately returns to a normal spanning tree port type and moves through the regular transitions. In that case, BPDU Filtering is disabled on this port, and spanning tree resumes sending BPDUs on this port.

In addition, you can configure BPDU Filtering by the individual interface. When you explicitly configure BPDU Filtering on a port, that port does not send any BPDUs and drops all BPDUs that it receives. You can effectively override the global BPDU Filtering setting on individual ports by configuring the specific interface. This BPDU Filtering command on the interface applies to the entire interface, whether the interface is trunking or not.


Caution


Use care when configuring BPDU Filtering per interface. If you explicitly configuring BPDU Filtering on a port that is not connected to a host, it can result in bridging loops because the port ignores any BPDU that it receives and goes to forwarding.


If the port configuration is not set to default BPDU Filtering, the edge configuration does not affect BPDU Filtering. The following table lists all the BPDU Filtering combinations.

Table 1. BPDU Filtering Configurations

BPDU Filtering Per Port Configuration

BPDU Filtering Global Configuration

STP Edge Port Configuration

BPDU Filtering State

Default

Enabled

Enabled

Enabled. The port transmits at least 10 BPDUs. If this port receives any BPDUs, the port returns to the spanning tree normal port state and BPDU Filtering is disabled.

Default

Enabled

Disabled

Disabled

Default

Disabled

Enabled/Disabled

Disabled

Disable

Enabled/Disabled

Enabled/Disabled

Disabled

Enabled

Enabled/Disabled

Enabled/Disabled

Enabled

Caution

 

BPDUs are never sent and if received, they do not trigger the regular STP behavior - use with caution.

Understanding Loop Guard

Loop Guard protects networks from loops that are caused by the following:

  • Network interfaces that malfunction

  • Busy CPUs

  • Anything that prevents the normal forwarding of BPDUs

An STP loop occurs when a blocking port in a redundant topology erroneously transitions to the forwarding state. This transition usually happens because one of the ports in a physically redundant topology (not necessarily the blocking port) stops receiving BPDUs.

Loop Guard is useful only in switched networks where devices are connected by point-to-point links. On a point-to-point link, a designated bridge cannot disappear unless it sends an inferior BPDU or brings the link down.


Note


Loop Guard can be enabled only on network and normal spanning tree port types.


You can use Loop Guard to determine if a root port or an alternate/backup root port receives BPDUs. If the port does not receive BPDUs, Loop Guard puts the port into an inconsistent state (blocking) until the port starts to receive BPDUs again. A port in the inconsistent state does not transmit BPDUs. If the port receives BPDUs again, the protocol removes its loop-inconsistent condition, and the STP determines the port state because such recovery is automatic.

Loop Guard isolates the failure and allows STP to converge to a stable topology without the failed link or bridge. Disabling Loop Guard moves all loop-inconsistent ports to the listening state.

You can enable Loop Guard on a per-port basis. When you enable Loop Guard on a port, it is automatically applied to all of the active instances or VLANs to which that port belongs. When you disable Loop Guard, it is disabled for the specified ports.

Understanding Root Guard

When you enable Root Guard on a port, Root Guard does not allow that port to become a root port. If a received BPDU triggers an STP convergence that makes that designated port become a root port, that port is put into a root-inconsistent (blocked) state. After the port stops sending superior BPDUs, the port is unblocked again. Through STP, the port moves to the forwarding state. Recovery is automatic.

Root Guard enabled on an interface applies this functionality to all VLANs to which that interface belongs.

You can use Root Guard to enforce the root bridge placement in the network. Root Guard ensures that the port on which Root Guard is enabled is the designated port. Normally, root bridge ports are all designated ports, unless two or more of the ports of the root bridge are connected. If the bridge receives superior BPDUs on a Root Guard-enabled port, the bridge moves this port to a root-inconsistent STP state. In this way, Root Guard enforces the position of the root bridge.

You cannot configure Root Guard globally.


Note


You can enable Root Guard on all spanning tree port types: normal, edge, and network ports.


Configuring STP Extensions

Guidelines for STP Extensions Configuration

When configuring STP extensions, follow these guidelines:

  • Configure all access and trunk ports connected to hosts as edge ports.

  • Bridge Assurance runs only on point-to-point spanning tree network ports. You must configure each side of the link for this feature.

  • Loop Guard does not run on spanning tree edge ports.

  • Enabling Loop Guard on ports that are not connected to a point-to-point link will not work.

  • You cannot enable Loop Guard if Root Guard is enabled.

  • After the maximum MAC learning limit , all incoming packets are not learnt in the MAC table and are forwarded based on the destination MAC.

Configuring Spanning Tree Port Types Globally

The spanning tree port type designation depends on the type of device the port is connected to, as follows:

  • Edge—Edge ports are connected to hosts and can be either an access port or a trunk port.

  • Network—Network ports are connected only to switches or bridges.

  • Normal—Normal ports are neither edge ports nor network ports; they are normal spanning tree ports. These ports can be connected to any type of device.

You can configure the port type either globally or per interface. By default, the spanning tree port type is normal.

Before you begin

Ensure that STP is configured.

Ensure that you are configuring the ports correctly for the type of device to which the interface is connected.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# spanning-tree port type edge default
  3. switch(config)# spanning-tree port type network default

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# spanning-tree port type edge default

Configures all interfaces as edge ports. Using this command assumes all ports are connected to hosts/servers. Edge ports immediately transition to the forwarding state without passing through the blocking or learning state at linkup. By default, spanning tree ports are normal port types.

Step 3

switch(config)# spanning-tree port type network default

Configures all interfaces as spanning tree network ports. Using this command assumes all ports are connected to switches and bridges. If you enable Bridge Assurance, it automatically runs on network ports. By default, spanning tree ports are normal port types.

Note

 

If you configure interfaces connected to hosts as network ports, those ports automatically move into the blocking state.

Example

This example shows how to configure all access and trunk ports connected to hosts as spanning tree edge ports:

switch# configure terminal
switch(config)# spanning-tree port type edge default
 

This example shows how to configure all ports connected to switches or bridges as spanning tree network ports:

switch# configure terminal
switch(config)# spanning-tree port type network default
 

Configuring Spanning Tree Edge Ports on Specified Interfaces

You can configure spanning tree edge ports on specified interfaces. Interfaces configured as spanning tree edge ports immediately transition to the forwarding state without passing through the blocking or learning states on linkup.

This command has four states:

  • spanning-tree port type edge —This command explicitly enables edge behavior on the access port.

  • spanning-tree port type edge trunk —This command explicitly enables edge behavior on the trunk port.


    Note


    If you enter the spanning-tree port type edge trunk command, the port is configured as an edge port even in the access mode.


  • spanning-tree port type normal —This command explicitly configures the port as a normal spanning tree port and the immediate transition to the forwarding state is not enabled.

  • no spanning-tree port type —This command implicitly enables edge behavior if you define the spanning-tree port type edge default command in global configuration mode. If you do not configure the edge ports globally, the no spanning-tree port type command is equivalent to the spanning-tree port type disable command.

Before you begin

Ensure that STP is configured.

Ensure that the interface is connected to hosts.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# interface type slot/port
  3. switch(config-if)# spanning-tree port type edge

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# interface type slot/port

Specifies the interface to configure, and enters the interface configuration mode.

Step 3

switch(config-if)# spanning-tree port type edge

Configures the specified access interfaces to be spanning edge ports. Edge ports immediately transition to the forwarding state without passing through the blocking or learning state at linkup. By default, spanning tree ports are normal port types.

Example

This example shows how to configure the Ethernet access interface 1/4 to be a spanning tree edge port:

switch# configure terminal
switch(config)# interface ethernet 1/4
switch(config-if)# spanning-tree port type edge
 

Enabling BPDU Guard Globally

You can enable BPDU Guard globally by default. In this condition, the system shuts down an edge port that receives a BPDU.


Note


We recommend that you enable BPDU Guard on all edge ports.


Before you begin

Ensure that STP is configured.

Ensure that you have configured some spanning tree edge ports.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# spanning-tree port type edge bpduguard default

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# spanning-tree port type edge bpduguard default

Enables BPDU Guard by default on all spanning tree edge ports. By default, global BPDU Guard is disabled.

Example

This example shows how to enable BPDU Guard on all spanning tree edge ports:

switch# configure terminal
switch(config)# spanning-tree port type edge bpduguard default
 

Enabling BPDU Guard on Specified Interfaces

You can enable BPDU Guard on specified interfaces. Enabling BPDU Guard shuts down the port if it receives a BPDU.

You can configure BPDU Guard on specified interfaces as follows:

  • spanning-tree bpduguard enable —Unconditionally enables BPDU Guard on the interface.

  • spanning-tree bpduguard disable —Unconditionally disables BPDU Guard on the interface.

  • no spanning-tree bpduguard —Enables BPDU Guard on the interface if it is an operational edge port and if the spanning-tree port type edge bpduguard default command is configured.

Before you begin

Ensure that STP is configured.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# interface type slot/port
  3. switch(config-if)# spanning-tree bpduguard {enable | disable}
  4. (Optional) switch(config-if)# no spanning-tree bpduguard

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# interface type slot/port

Specifies the interface to configure, and enters the interface configuration mode.

Step 3

switch(config-if)# spanning-tree bpduguard {enable | disable}

Enables or disables BPDU Guard for the specified spanning tree edge interface. By default, BPDU Guard is disabled on physical Ethernet interfaces.

Step 4

(Optional) switch(config-if)# no spanning-tree bpduguard

(Optional)

Disables BPDU Guard on the interface.

Note

 

Enables BPDU Guard on the interface if it is an operational edge port and if you enter the spanning-tree port type edge bpduguard default command.

Example

This example shows how to explicitly enable BPDU Guard on the Ethernet edge port 1/4:

switch# configure terminal
switch (config)# interface ethernet 1/4
switch(config-if)# spanning-tree bpduguard enable
switch(config-if)# no spanning-tree bpduguard
 

Enabling BPDU Filtering Globally

You can enable BPDU Filtering globally by default on spanning tree edge ports.

If an edge port with BPDU Filtering enabled receives a BPDU, it loses its operation status and as edge port and resumes the regular STP transitions. However, this port maintains it configuration as an edge port.


Caution


Be careful when using this command: using it incorrectly can cause bridging loops.



Note


When enabled globally, BPDU Filtering is applied only on ports that are operational edge ports. Ports send a few BPDUs at linkup before they effectively filter outbound BPDUs. If a BPDU is received on an edge port, it immediately loses its operational edge port status and BPDU Filtering is disabled.


Before you begin

Ensure that STP is configured.

Ensure that you have configured some spanning tree edge ports.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# spanning-tree port type edge bpdufilter default

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# spanning-tree port type edge bpdufilter default

Enables BPDU Filtering by default on all operational spanning tree edge ports. Global BPDU Filtering is disabled by default.

Example

This example shows how to enable BPDU Filtering on all operational spanning tree edge ports:

switch# configure terminal
switch(config)# spanning-tree port type edge bpdufilter default
 

Enabling BPDU Filtering on Specified Interfaces

You can apply BPDU Filtering to specified interfaces. When enabled on an interface, that interface does not send any BPDUs and drops all BPDUs that it receives. This BPDU Filtering functionality applies to the entire interface, whether trunking or not.


Caution


Be careful when you enter the spanning-tree bpdufilter enable command on specified interfaces. Explicitly configuring BPDU Filtering on a port that is not connected to a host can result in bridging loops because the port ignores any BPDU it receives and goes to forwarding.


You can enter this command to override the port configuration on specified interfaces.

This command has three states:

  • spanning-tree bpdufilter enable —Unconditionally enables BPDU Filtering on the interface.

  • spanning-tree bpdufilter disable —Unconditionally disables BPDU Filtering on the interface.

  • no spanning-tree bpdufilter —Enables BPDU Filtering on the interface if the interface is an operational edge port and if you configure the spanning-tree port type edge bpdufilter default command.


Note


When you enable BPDU Filtering locally on a port, this feature prevents the device from receiving or sending BPDUs on this port.


Before you begin

Ensure that STP is configured.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# interface type slot/port
  3. switch(config-if)# spanning-tree bpdufilter {enable | disable}
  4. (Optional) switch(config-if)# no spanning-tree bpdufilter

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# interface type slot/port

Specifies the interface to configure, and enters the interface configuration mode.

Step 3

switch(config-if)# spanning-tree bpdufilter {enable | disable}

Enables or disables BPDU Filtering for the specified spanning tree edge interface. By default, BPDU Filtering is disabled.

Step 4

(Optional) switch(config-if)# no spanning-tree bpdufilter

(Optional)

Disables BPDU Filtering on the interface.

Note

 

Enables BPDU Filtering on the interface if the interface is an operational spanning tree edge port and if you enter the spanning-tree port type edge bpdufilter default command.

Example

This example shows how to explicitly enable BPDU Filtering on the Ethernet spanning tree edge port 1/4:

switch# configure terminal
switch (config)# interface ethernet 1/4
switch(config-if)# spanning-tree bpdufilter enable
 

Enabling Loop Guard Globally

You can enable Loop Guard globally by default on all point-to-point spanning tree normal and network ports. Loop Guard does not run on edge ports.

Loop Guard provides additional security in the bridge network. Loop Guard prevents alternate or root ports from becoming the designated port because of a failure that could lead to a unidirectional link.


Note


Entering the Loop Guard command for the specified interface overrides the global Loop Guard command.


Before you begin

Ensure that STP is configured.

Ensure that you have spanning tree normal ports or have configured some network ports.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# spanning-tree loopguard default

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# spanning-tree loopguard default

Enables Loop Guard by default on all spanning tree normal and network ports. By default, global Loop Guard is disabled.

Example

This example shows how to enable Loop Guard on all spanning tree normal or network ports:

switch# configure terminal
switch(config)# spanning-tree loopguard default
 

Enabling Loop Guard or Root Guard on Specified Interfaces

You can enable either Loop Guard or Root Guard on specified interfaces.

Enabling Root Guard on a port means that port cannot become a root port, and LoopGuard prevents alternate or root ports from becoming the designated port because of a failure that could lead to a unidirectional link.

Both Loop Guard and Root Guard enabled on an interface apply to all VLANs to which that interface belongs.


Note


Entering the Loop Guard command for the specified interface overrides the global Loop Guard command.


Before you begin

Ensure that STP is configured.

Ensure that you are configuring Loop Guard on spanning tree normal or network ports.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# interface type slot/port
  3. switch(config-if)# spanning-tree guard {loop | root | none}

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# interface type slot/port

Specifies the interface to configure, and enters the interface configuration mode.

Step 3

switch(config-if)# spanning-tree guard {loop | root | none}

Enables or disables either Loop Guard or Root Guard for the specified interface. By default, Root Guard is disabled by default, and Loop Guard on specified ports is also disabled.

Note

 

Loop Guard runs only on spanning tree normal and network interfaces.

Example

This example shows how to enable Root Guard on Ethernet port 1/4:

switch# configure terminal
switch (config)# interface ethernet 1/4
switch(config-if)# spanning-tree guard root
 

Verifying the STP Extension Configuration

Use the following commands to display the configuration information for the STP extensions.

Command

Purpose

show running-config spanning-tree [all]

Displays the current status of spanning tree on the switch.

show spanning-tree [options]

Displays selected detailed information for the current spanning tree configuration.

Generating Syslog Error Messages

It is not always sufficient to enable the MAC-move notification in order to generate a syslog message about MAC-move notification. In order to ensure syslog message generation, enter these commands in conjunction with the previous command: mac address-table notification mac-move.

SUMMARY STEPS

  1. conf t
  2. logging level spanning-tree 6
  3. logging level l2fm 5
  4. logging monitor 6

DETAILED STEPS

  Command or Action Purpose

Step 1

conf t

Enters the configuration mode.

Step 2

logging level spanning-tree 6

Enables logging of all spanning-tree events from level 6 up to the highest severity events.

Step 3

logging level l2fm 5

Enables logging of all L2FM events from level 5 up to the highest severity events.

Step 4

logging monitor 6

Enables the device to log messages to the monitor based on severity level 6 or higher.

The addition of these commands ensures that the syslog for L2FM detect displays when there is a MAC address move. In order to verify the STP port state across VLANs on the switches, enter the following commands.
switch# show spanning-tree
switch# show spanning-tree vlan <id> 
switch# show spanning-tree internal interaction

Example

In order to check if the MAC addresses move, enter the command:
# show mac address-table notification mac-move
 MAC Move Notify Triggers: 1206
 Number of MAC Addresses added: 944088
 Number of MAC Addresses moved: 265
 Number of MAC Addresses removed: 943920
 
The MAC address moves are also logged with a minimum logging level of five that is required to display which MAC addresses move:
2018 Nov 14 16:04:23.881 N9K %L2FM-4-L2FM_MAC_MOVE2: Mac XXXX.XXXX.XXXX in vlan 741 has moved between Po6 to Eth1/3
2018 Nov 14 16:04:23.883 N9K %L2FM-4-L2FM_MAC_MOVE2: Mac XXXX.XXXX.XXXX in vlan 741 has moved between Po6 to Eth1/3

What to do next

Check for correct STP convergence and for STP port-states across all the switches in the topology. Confirm that there are no disputes or incorrect port states.

If the source of the data frames that are physically moving is identified, control the source in order to halt the rapid and continuous moves.

By default, dynamic learning is re-enabled after 180 seconds. At that point, any STP disputes or inconsistencies should be resolved. If not, the dynamic learning is disabled again.