Chapter 2

Spanning Tree Protocol

This chapter provides information and commands concerning the following topics:

Spanning Tree Protocol Definition

The spanning-tree standards offer the same safety that routing protocols provide in Layer 3 forwarding environments to Layer 2 bridging environments. A single best path to a main bridge is found and maintained in the Layer 2 domain, and other redundant paths are managed by selective port blocking. Appropriate blocked ports begin forwarding when primary paths to the main bridge are no longer available.

There are several different spanning-tree modes and protocols:

  • Per VLAN Spanning Tree (PVST+): This spanning-tree mode is based on the IEEE 802.1D standard and Cisco proprietary extensions. The PVST+ runs on each VLAN on the device up to the maximum supported, ensuring that each has a loop-free path through the network. PVST+ provides Layer 2 load balancing for the VLAN on which it runs. You can create different logical topologies by using the VLANs on your network to ensure that all of your links are used but that no one link is oversubscribed. Each instance of PVST+ on a VLAN has a single root device. This root device propagates the spanning-tree information associated with that VLAN to all other devices in the network. Because each device has the same information about the network, this process ensures that the network topology is maintained.

  • Rapid PVST+: This spanning-tree mode is the same as PVST+ except that it uses a rapid convergence based on the IEEE 802.1w standard. Beginning from Cisco IOS Release 15.2(4)E, the STP default mode is Rapid PVST+. To provide rapid convergence, Rapid PVST+ immediately deletes dynamically learned MAC address entries on a per-port basis upon receiving a topology change. By contrast, PVST+ uses a short aging time for dynamically learned MAC address entries. Rapid PVST+ uses the same configuration as PVST+ and the device needs only minimal extra configuration. The benefit of Rapid PVST+ is that you can migrate a large PVST+ install base to Rapid PVST+ without having to learn the complexities of the Multiple Spanning Tree Protocol (MSTP) configuration and without having to reprovision your network. In Rapid PVST+ mode, each VLAN runs its own spanning-tree instance up to the maximum supported.

  • Multiple Spanning Tree Protocol (MSTP): This spanning-tree mode is based on the IEEE 802.1s standard. You can map multiple VLANs to the same spanning-tree instance, which reduces the number of spanning-tree instances required to support a large number of VLANs. MSTP runs on top of the Rapid Spanning Tree Protocol (RSTP) (based on IEEE 802.1w), which provides for rapid convergence of the spanning tree by eliminating the forward delay and by quickly transitioning root ports and designated ports to the forwarding state. In a device stack, the cross-stack rapid transition (CSRT) feature performs the same function as RSTP. You cannot run MSTP without RSTP or CSRT.

Note

Default spanning-tree implementation for Catalyst 2950, 2960, 3550, 3560, and 3750 switches is PVST+. This is a per-VLAN implementation of 802.1D. Beginning from Cisco IOS Release 15.2(4)E, the STP default mode is Rapid PVST+ on all switch platforms.

Enabling Spanning Tree Protocol

Switch(config)# spanning-tree vlan 5

Enables STP on VLAN 5

Switch(config)# no spanning-tree vlan 5

Disables STP on VLAN 5

Note

Many access switches such as the Catalyst 2960, 3550, 3560, 3650, 9200, and 9300 support a maximum 128 spanning trees using any combination of PVST+ or Rapid PVST+. The 2950 model supports only 64 instances. Any VLANs created in excess of 128 spanning trees cannot have a spanning-tree instance running in them. There is a possibility of an L2 loop that could not be broken in the case where a VLAN without spanning tree is transported across a trunk. It is recommended that you use MSTP if the number of VLANs in a common topology is high.

Caution

Spanning tree is enabled by default on VLAN 1 and on all newly created VLANs up to the spanning-tree limit. Disable spanning tree only if you are sure there are no loops in the network topology. When spanning tree is disabled and loops are present in the topology, excessive traffic and indefinite packet duplication can drastically reduce network performance. Networks have been known to crash in seconds due to broadcast storms created by loops.

Changing the Spanning-Tree Mode

You can configure different types of spanning trees on a Cisco switch. The options vary according to the platform.

Switch(config)# spanning-tree mode pvst

Enables PVST+. This is the default setting

Switch(config)# spanning-tree mode mst

Enters MST mode

Switch(config)# spanning-tree mst configuration

Enters MST subconfiguration mode

Note

Use the command no spanning-tree mst configuration to clear the MST configuration

Switch(config)# spanning-tree mode rapid-pvst

Enables Rapid PVST+

Switch# clear spanning-tree detected-protocols

If any port on the device is connected to a port on a legacy IEEE 802.1D device, this command restarts the protocol migration process on the entire device

This step is optional if the designated device detects that this device is running Rapid PVST+

Configuring the Root Switch

Switch(config)# spanning-tree vlan 5 root primary

Modifies the switch priority from the default 32768 to a lower value to allow the switch to become the primary root switch for VLAN 5

Note

This switch sets its priority to 24576. If any other switch has a priority set to below 24576 already, this switch sets its own priority to 4096 less than the lowest switch priority. If by doing this the switch has a priority of less than 1, this command fails

Switch(config)# spanning-tree vlan 5 root primary

Configures the switch to become the root switch for VLAN 5

Note

The maximum switch topology width and the hello-time can be set within this command

Tip

The root switch should be a backbone or distribution switch

Switch(config)# spanning-tree vlan 5 root primary diameter 6

Configures the switch to be the root switch for VLAN 5 and sets the network diameter to 6

Tip

The diameter keyword defines the maximum number of switches between any two end stations. The range is from 2 to 7 switches. The default value is 7

Tip

The hello-time keyword sets the hello-interval timer to any amount between 1 and 10 seconds. The default time is 2 seconds

Configuring a Secondary Root Switch

Switch(config)# spanning-tree vlan 5 root secondary

Configures the switch to become the root switch for VLAN 5 should the primary root switch fail

Note

This switch lowers its priority to 28672. If the root switch fails and all other switches are set to the default priority of 32768, this becomes the new root switch

Switch(config)# spanning-tree vlan 5 root secondary diameter 7

Configures the switch to be the secondary root switch for VLAN 5 and sets the network diameter to 7

Configuring Port Priority

Switch(config)# interface gigabitethernet 1/0/1

Moves to interface configuration mode

Switch(config-if)# spanning-tree port-priority 64

Configures the port priority for the interface that is an access port

Switch(config-if)# spanning-tree vlan 5 port-priority 64

Configures the VLAN port priority for an interface that is a trunk port

Note

If a loop occurs, spanning tree uses the port priority when selecting an interface to put into the forwarding state. Assign a higher priority value (lower numerical number) to interfaces you want selected first and a lower priority value (higher numerical number) to interfaces you want selected last

The number can be between 0 and 240 in increments of 16. The default port priority is 128

Note

The port priority setting supersedes the physical port number in spanning-tree calculations.

Configuring the Path Cost

Switch(config)# interface gigabitethernet 1/0/1

Moves to interface configuration mode

Switch(config-if)# spanning-tree cost 100000

Configures the cost for the interface that is an access port. The range is 1 to 200000000; the default value is derived from the media speed of the interface

Switch(config-if)# spanning-tree vlan 5 cost 1500000

Configures the VLAN cost for an interface that is a trunk port. The VLAN number can be specified as a single VLAN ID number, a range of VLANs separated by a hyphen, or a series of VLANs separated by a comma. The range is 1 to 4094. For the cost, the range is 1 to 200000000; the default value is derived from the media speed of the interface

Note

If a loop occurs, STP uses the path cost when trying to determine which interface to place into the forwarding state. A higher path cost means a lower-speed transmission

Configuring the Switch Priority of a VLAN

Switch(config)# spanning-tree vlan 5 priority 12288

Configures the switch priority of VLAN 5 to 12288

Note

With the priority keyword, the range is 0 to 61440 in increments of 4096. The default is 32768. The lower the priority, the more likely the switch will be chosen as the root switch. Only the following numbers can be used as priority values:

0

4096

8192

12288

16384

20480

24576

28672

32768

36864

40960

45056

49152

53248

57344

61440

Caution

Cisco recommends caution when using this command. Cisco further recommends that the spanning-tree vlan x root primary or the spanning-tree vlan x root secondary command be used instead to modify the switch priority.

Configuring STP Timers

Switch(config)# spanning-tree vlan 5 hello-time 4

Changes the hello-delay timer to 4 seconds on VLAN 5

Switch(config)# spanning-tree vlan 5 forward-time 20

Changes the forward-delay timer to 20 seconds on VLAN 5

Switch(config)# spanning-tree vlan 5 max-age 25

Changes the maximum-aging timer to 25 seconds on VLAN 5

Note

For the hello-time command, the range is 1 to 10 seconds. The default is 2 seconds.

For the forward-time command, the range is 4 to 30 seconds. The default is 15 seconds.

For the max-age command, the range is 6 to 40 seconds. The default is 20 seconds.

Configuring Optional Spanning-Tree Features

Although the following commands are not mandatory for STP to work, you might find these helpful to fine-tune your network.

PortFast

Note

By default, PortFast is disabled on all interfaces.

Switch(config)# interface gigabitethernet 1/0/10

Moves to interface configuration mode

Switch(config-if)# spanning-tree portfast

Enables PortFast if the port is already configured as an access port

Switch(config-if)# spanning-tree portfast disable

Disables PortFast for the interface

Switch(config-if)# spanning-tree portfast edge

Enables the PortFast edge feature for the interface

Switch(config-if)# spanning-tree portfast network

Enables PortFast network for the interface

Note

Use this command on trunk ports to enable the Bridge Assurance feature, which protects against loops by detecting unidirectional links in the spanning-tree topology

Note

Bridge Assurance is enabled globally by default

Switch(config-if)# spanning-tree portfast trunk

Enables PortFast on a trunk port

Caution

Use the PortFast command only when connecting a single end station to an access or trunk port. Using this command on a port connected to a switch or hub might prevent spanning tree from detecting loops

Note

If you enable the voice VLAN feature, PortFast is enabled automatically. If you disable voice VLAN, PortFast is still enabled

Switch(config)# spanning-tree portfast default

Globally enables PortFast on all switchports that are nontrunking

Note

You can override the spanning-tree portfast default global configuration command by using the spanning-tree portfast disable interface configuration command

Switch# show spanning-tree interface gigabitethernet 1/0/10 portfast

Displays PortFast information on interface GigabitEthernet 1/0/10

BPDU Guard (2xxx/older 3xxx Series)

Switch(config)# spanning-tree portfast bpduguard default

Globally enables BPDU Guard on ports where portfast is enabled

Switch(config)# interface range fastethernet 0/1 - 5

Enters interface range configuration mode

Switch(config-if-range)# spanning-tree portfast

Enables PortFast on all interfaces in the range

Note

Best practice is to enable PortFast at the same time as BPDU Guard

Switch(config-if-range)# spanning-tree bpduguard enable

Enables BPDU Guard on the interface

Note

By default, BPDU Guard is disabled

Switch(config-if)# spanning-tree bpduguard disable

Disables BPDU Guard on the interface

Switch(config)# errdisable recovery cause bpduguard

Allows port to reenable itself if the cause of the error is BPDU Guard by setting a recovery timer

Switch(config)# errdisable recovery interval 400

Sets recovery timer to 400 seconds. The default is 300 seconds. The range is from 30 to 86 400 seconds

Switch# show spanning-tree summary totals

Verifies whether BPDU Guard is enabled or disabled

Switch# show errdisable recovery

Displays errdisable recovery timer information

BPDU Guard (3650/9xxx Series)

You can enable the BPDU Guard feature if your switch is running PVST+, Rapid PVST+, or MSTP.

The BPDU Guard feature can be globally enabled on the switch or can be enabled per port.

When you enable BPDU Guard at the global level on PortFast-enabled ports, spanning tree shuts down ports that are in a PortFast-operational state if any BPDU is received on them. When you enable BPDU Guard at the interface level on any port without also enabling the PortFast feature, and the port receives a BPDU, it is put in the error-disabled state.

Switch(config)# spanning-tree portfast bpduguard default

Enables BPDU Guard globally

Note

By default, BPDU Guard is disabled

Switch(config)# interface gigabitethernet 1/0/2

Enters into interface configuration mode

Switch(config-if)# spanning-tree portfast edge

Enables the PortFast edge feature

Switch(config-if)# end

Returns to privileged EXEC mode

BPDU Filter

Switch(config)# spanning-tree portfast bpdufilter default

Globally enables BPDU filtering on PortFast-enabled port; prevents ports in PortFast from sending or receiving BPDUs

Switch(config)# interface range gigabitethernet 1/0/1-4

Enters interface range configuration mode

Switch(config-if-range)# spanning-tree portfast

Enables PortFast on all interfaces in the range

Switch(config-if-range)# spanning-tree portfast edge

Enables PortFast on all interfaces in the range

Note

This is the command for the 3650/9300 series

Switch(config-if-range)# spanning-tree bpdufilter enable

Enables BPDU Filter on all interfaces in the range configured with “PortFast”

Note

By default, BPDU filtering is disabled. Also, BPDU Guard has no effect on an interface if BPDU filtering is enabled

Caution

Enabling BPDU filtering on an interface, or globally, is the same as disabling STP, which can result in spanning-tree loops being created but not detected

Switch# show spanning-tree summary totals

Displays global BPDU filtering configuration information

Switch# show spanning-tree interface [interface-type, interface-number] detail

Displays detailed spanning-tree interface status and configuration information of the specified interface

UplinkFast

Switch(config)# spanning-tree uplinkfast

Enables UplinkFast. UplinkFast provides fast convergence after a direct link failure

Switch(config)# spanning-tree uplinkfast max-update-rate 200

Enables UplinkFast and sets the update packet rate to 200 packets/second

Note

UplinkFast cannot be set on an individual VLAN. The spanning-tree uplinkfast command affects all VLANs

Note

For the max-update-rate argument, the range is 0 to 32,000 packets/second. The default is 150. If you set the rate to 0, station-learning frames are not generated. This will cause STP to converge more slowly after a loss of connectivity

Switch# show spanning-tree summary

Verifies whether UplinkFast has been enabled

Switch# show spanning-tree uplinkfast

Displays spanning-tree UplinkFast status, which includes maximum update packet rate and participating interfaces

Note

UplinkFast cannot be enabled on VLANs that have been configured for switch priority.

Note

UplinkFast is most useful in access layer switches, or switches at the edge of the network. It is not appropriate for backbone devices.

Note

You can configure the UplinkFast feature for Rapid PVST+ or for the MSTP, but the feature remains disabled (inactive) until you change the spanning-tree mode to PVST+.

BackboneFast

Switch(config)# spanning-tree backbonefast

Enables BackboneFast. BackboneFast is initiated when a root port or blocked port receives an inferior BPDU from its designated bridge

Switch# show spanning-tree summary

Verifies BackboneFast has been enabled

Switch# show spanning-tree backbonefast

Displays spanning-tree BackboneFast status, which includes the number of root link query protocol data units (PDUs) sent/received and number of BackboneFast transitions

Note

You can configure the BackboneFast feature for Rapid PVST+ or for the MSTP, but the feature remains disabled (inactive) until you change the spanning-tree mode to PVST+.

Note

If you use BackboneFast, you must enable it on all switches in the network.

Root Guard

You can use Root Guard to limit which switch can become the root bridge. Root Guard should be enabled on all ports where the root bridge is not anticipated, such as access ports.

Switch(config)# interface gigabitethernet 1/0/1

Moves to interface configuration mode

Switch(config-if)# spanning-tree guard root

Enables Root Guard on the interface

Switch# show spanning-tree inconsistentports

Indicates whether any ports are in a root-inconsistent state

Switch# show spanning-tree root

Displays the status and configuration of the root bridge

Note

The show spanning-tree root command output includes root ID for all VLANs, the associated root costs, timer settings, and root ports

Switch# show spanning-tree

Displays detailed spanning-tree state and configuration for each VLAN on the switch, including bridge and root IDs, timers, root costs, and forwarding status

Note

You cannot enable both Root Guard and Loop Guard at the same time.

Note

Root Guard enabled on an interface applies to all VLANs to which the interface belongs.

Note

Do not enable Root Guard on interfaces to be used by the UplinkFast feature.

Loop Guard

Loop Guard is used to prevent alternate or root ports from becoming designated ports due to a failure that leads to a unidirectional link. Loop Guard operates only on interfaces that are considered point to point by the spanning tree. Spanning tree determines a port to be point to point or shared from the port duplex setting. You can use Loop Guard to prevent alternate or root ports from becoming designated ports because of a failure that leads to a unidirectional link. This feature is most effective when it is enabled on the entire switched network. When Loop Guard is enabled, spanning tree does not send BPDUs on root or alternate ports.

Note

Both the port duplex and the spanning-tree link type can be set manually.

Note

You cannot enable both Loop Guard and Root Guard on the same port. The Loop Guard feature is most effective when it is configured on the entire switched network.

Switch# show spanning-tree active

Shows which ports are alternate or root ports

Switch# show spanning-tree mst

Shows which ports are alternate or root ports when the switch is operating in MST mode

Switch# configure terminal

Moves to global configuration mode

Switch(config)# spanning-tree loopguard default

Enables Loop Guard globally on the switch for those interfaces that the spanning tree identifies as point to point

Switch(config)# interface gigabitethernet 1/0/1

Moves to interface configuration mode

Switch(config-if)# spanning-tree guard loop

Enables Loop Guard on all the VLANs associated with the selected interface

Switch(config-if)# exit

Returns to privileged EXEC mode

Switch# show spanning-tree summary

Verifies whether Loop Guard has been enabled

Switch# show spanning-tree interface detail

Display spanning-tree link type. A link type of “point to point” is required for Loop Guard

Unidirectional Link Detection

Switch(config)# udld enable

Enables unidirectional link detection (UDLD) on all fiber-optic interfaces to determine the Layer 1 status of the link

Note

By default, UDLD is disabled

Switch(config)# udld aggressive

Enables UDLD aggressive mode on all fiber-optic interfaces

Switch(config)# interface gigabitethernet 1/0/1

Moves to interface configuration mode

Switch(config-if)# udld port [aggressive]

Enables UDLD on this interface (required for copper-based interfaces) in normal or aggressive mode

Note

On a fiber-optic (FO) interface, the interface command udld port overrides the global command udld enable. Therefore, if you issue the command no udld port on an FO interface, you will still have the globally enabled udld enable command to deal with

Switch# show udld

Displays UDLD information

Switch# show udld interface

gigabitethernet 1/0/1

Displays UDLD information for interface Gigabit Ethernet 1/0/1

Switch# udld reset

Resets all interfaces shut down by UDLD

Note

You can also use the shutdown command, followed by a no shutdown command in interface configuration mode, to restart a disabled interface

Configuring and Verifying Port Error Conditions

A port is “error-disabled” when the switch detects any one of a number of port violations. No traffic is sent or received when the port is in error-disabled state. The show errdisable detect command displays a list for the possible error-disabled reasons and whether enabled.

The errdisable detect cause command allows the network device administrator to enable or disable detection of individual error-disabled causes. All causes are enabled by default. All causes, except for per-VLAN error disabling, are configured to shut down the entire port.

The errdisable recovery command enables the network device administrator to configure automatic recovery mechanism variables. This would allow the switch port to again send and receive traffic after a configured period of time if the initial error condition is no longer present. All recovery mechanisms are disabled by default.

Switch(config)# errdisable detect cause all

Enables error detection for all error-disabled causes

Switch(config)# errdisable detect cause bpduguard shutdown vlan

Enables per-VLAN error-disable for BPDU Guard

Switch(config)# errdisable detect cause dhcp-rate-limit

Enables error detection for DHCP snooping

Switch(config)# errdisable detect cause dtp-flap

Enables error detection for Dynamic Trunk Protocol (DTP) flapping

Switch(config)# errdisable detect cause gbic-invalid

Enables error detection for invalid Gigabit Interface Converter (GBIC) module.

Note

You can also use the shutdown command, followed by a no shutdown command in interface configuration mode, to restart a disabled interface. This error refers to an invalid small form-factor pluggable (SFP) module on the switch

Switch(config)# errdisable detect cause inline-power

Enables error detection for inline power

Switch(config)# errdisable detect cause link-flap

Enables error detection for link-state flapping

Switch(config)# errdisable detect cause loopback

Enables error detection for detected loopbacks

Switch(config)# errdisable detect cause pagp-flap

Enables error detection for the Port Aggregation Protocol (PAgP) flap error-disabled cause

Switch(config)# errdisable detect cause security-violation shutdown vlan

Enables voice-aware 802.1X security

Switch(config)# errdisable detect cause sfp-config-mismatch

Enables error detection on an SFP configuration mismatch

Switch(config)# errdisable recovery interval 3600

Configures errdisable recovery timer to 3600 seconds

Note

The same interval is applied to all causes. The range is 30 to 86,400 seconds. The default interval is 300 seconds

Switch(config)# errdisable recovery cause parameter

Enables the error-disabled mechanism to recover from specific cause parameter. Parameters are shown below

Switch(config)# errdisable recovery cause all

Enables the timer to recover from all error-disabled causes

Switch(config)# errdisable recovery cause bpduguard

Enables the timer to recover from BPDU Guard error-disabled state

Switch(config)# errdisable recovery cause channel-misconfig

Enable the timer to recover from the EtherChannel misconfiguration error-disabled state

Switch(config)# errdisable recovery cause dhcp-rate-limit

Enables the timer to recover from the DHCP snooping error-disabled state

Switch(config)# errdisable recovery cause dtp-flap

Enables the timer to recover from the DTP-flap error-disabled state

Switch(config)# errdisable recovery cause gbic-invalid

Enables the timer to recover from the GBIC module error-disabled state

Note

This error refers to an invalid SFP error-disabled state

Switch(config)# errdisable recovery cause inline-power

Enables the timer to recover for inline power

Switch(config)# errdisable recovery cause link-flap

Enables the timer to recover from the link-flap error-disabled state

Switch(config)# errdisable recovery cause loopback

Enables the timer to recover from a loopback error-disabled state

Switch(config)# errdisable recovery cause pagp-flap

Enables the timer to recover from the PAgP-flap error-disabled state

Switch(config)# errdisable recovery cause psecure-violation

Enables the timer to recover from a port security violation disabled state

Switch(config)# errdisable recovery cause security-violation

Enables the timer to recover from an IEEE 802.1X-violation disabled state

Switch(config)# errdisable recovery cause sfp-mismatch

Enables the timer to recover from an SFP configuration mismatch

Switch# show errdisable detect

Displays error-disabled detection status

Switch# show errdisable detect | begin expression

Display begins with the line that matches the expression

Note

expression is the output to use as a reference point

Switch# show errdisable detect | exclude expression

Display excludes lines that match the expression

Switch# show errdisable detect | include expression

Display includes lines that match the expression

Switch# show errdisable recovery

Displays the error-disabled recovery timer status information

Switch# show errdisable recovery | begin expression

Display begins with the line that matches the expression

Switch# show errdisable recovery | exclude expression

Display excludes lines that match the expression

Switch# show errdisable recovery | include expression

Display includes lines that match the expression

Enabling Rapid Spanning Tree

Switch(config)# spanning-tree mode rapid-pvst

Enables Rapid PVST+

Switch# clear spanning-tree detected-protocols

Restarts the protocol migration process. With no arguments, the command is applied to every port of the switch

Switch# clear spanning-tree detected-protocols interface gigabitethernet 1/0/1

Restarts the protocol migration process on interface GigabitEthernet 1/0/1

Switch# clear spanning-tree detected-protocols port-channel 1

Restarts the protocol migration process on interface port-channel 1

Switch# show spanning-tree

Displays mode, root and bridge IDs, participating ports, and their spanning-tree states

Switch# show spanning-tree summary

Summarizes configured port states, including spanning-tree mode

Switch# show spanning-tree detail

Displays a detailed summary of spanning-tree interface information, including mode, priority, system ID, MAC address, timers, and role in the spanning tree for each VLAN and port

Rapid Spanning Tree Link Types

The link type in RSTP can predetermine the active role that the port plays as it stands by for immediate transition to a forwarding state, if certain parameters are met. These parameters are different for edge ports and non-edge ports. An edge port is a switch port that is never intended to be connected to another switch device. It immediately transitions to the forwarding state when enabled—similar to an STP port with the PortFast featured enabled. However, an edge port that receives a BPDU immediately loses its edge port status and becomes a normal spanning-tree port. Non-edge ports are ports that are intended to be connected to another switch device. Link type is automatically determined but can be overwritten with an explicit port configuration. There are two different link types for non-edge ports, as shown in Table 2-1.

Link Type

Description

Point-to-point

A port operating in full-duplex mode. It is assumed that the port is connected to a single switch device at the other end of the link

Shared

A port operating in half-duplex mode. It is assumed that the port is connected to shared media where multiple switches may exist

TABLE 2-1 RSTP Non-Edge Link Types

Switch(config)#

spanning-tree mode rapid-pvst

Enables Rapid PVST+

Switch(config)#

interface gigabitethernet 1/0/1

Moves to interface configuration mode

Switch(config-if)#

spanning-tree link-type auto

Sets the link type based on the duplex setting of the interface

Switch(config-if)#

spanning-tree link-type point-to-point

Specifies that the interface is a point-to-point link

Switch(config-if)#

spanning-tree link-type shared

Specifies that the interface is a shared medium

Switch(config-if)#

exit

Returns to global configuration mode

Enabling Multiple Spanning Tree

Switch(config)# spanning-tree mode mst

Enters MST mode

Switch(config)# spanning-tree mst configuration

Enters MST configuration submode

Switch(config-mst)# instance 1 vlan 4

Maps VLAN 4 to Multiple Spanning Tree (MST) instance 1

Switch(config-mst)# instance 1 vlan 1-15

Maps VLANs 1–15 to MST instance 1

Switch(config-mst)# instance 1 vlan 10,20,30

Maps VLANs 10, 20, and 30 to MST instance 1

Note

For the instance x vlan y command, the instance must be a number between 1 and 15, and the VLAN range is 1 to 4094

Switch(config-mst)# name region12

Specifies the name for the MST region. The default is an empty string

Note

The name argument can be up to 32 characters long and is case sensitive

Switch(config-mst)# revision 4

Specifies the revision number

Note

The range for the revision argument is 0 to 65,535

Note

For two or more bridges to be in the same MST region, they must have the identical MST name, VLAN-to-instance mapping, and MST revision number

Switch(config-mst)# show current

Displays the summary of what is currently configured for the MST region

Switch(config-mst)# show pending

Verifies the configuration by displaying a summary of what you have configured for the MST region

Switch(config-mst)# exit

Applies all changes and returns to global configuration mode

Switch(config)# spanning-tree mst 1 priority 4096

Sets the bridge priority for the spanning tree to 4096. The priority can be a number from 0–61440 in increments of 4096

Caution

Changing spanning-tree modes can disrupt traffic because all spanning-tree instances are stopped for the old mode and restarted in the new mode

Note

You cannot run both MSTP and PVST at the same time

Switch(config)# spanning-tree mst 1 root primary

Configures a switch as a primary root switch within MST instance 1. The primary root switch priority is 24,576

Switch(config)# spanning-tree mst 1 root secondary

Configures a switch as a secondary root switch within MST instance 1. The secondary root switch priority is 28,672

Switch(config-if)# spanning-tree mst 20 port-priority 0

Configures an interface with a port priority of 0 for MST instance 20

Note

The priority range is 0 to 240 in increments of 16, where the lower the number, the higher the priority. The default is 128. The range and increment values are platform and IOS version dependent

Switch(config-if)# spanning-tree mst 2 cost 250

Sets the path cost to 250 for MST instance 2 calculations. Path cost is 1 to 200,000,000, with higher values meaning higher costs

Switch(config-if)# end

Returns to privileged EXEC mode

Verifying the Extended System ID

Switch# show spanning-tree summary

Verifies that the extended system ID is enabled

Switch# show spanning-tree bridge

Displays the extended system ID as part of the bridge ID

Note

The 12-bit extended system ID is the VLAN number for the instance of PVST+ and PVRST+ spanning tree. In MST, these 12 bits carry the instance number

Verifying STP

Switch# show spanning-tree

Displays STP information

Switch# show spanning-tree active

Displays STP information on active interfaces only

Switch# show spanning-tree bridge

Displays status and configuration of this bridge

Switch# show spanning-tree detail

Displays a detailed summary of interface information

Switch# show spanning-tree interface gigabitethernet 1/0/1

Displays STP information for interface gigabitethernet 1/0/1

Switch# show spanning-tree summary

Displays a summary of port states

Switch# show spanning-tree summary totals

Displays the total lines of the STP section

Switch# show spanning-tree vlan 5

Displays STP information for VLAN 5

Switch# show spanning-tree mst configuration

Displays the MST region configuration

Switch# show spanning-tree mst configuration digest

Displays the message digest 5 (MD5) authentication digest included in the current MST configuration identifier (MSTCI)

Switch# show spanning-tree mst 1

Displays the MST information for instance 1

Switch# show spanning-tree mst interface gigabitethernet 1/0/1

Displays the MST information for interface GigabitEthernet 1/0/1

Switch# show spanning-tree mst 1 interface gigabitethernet 1/0/1

Displays the MST information for instance 1 on interface GigabitEthernet 1/0/1

Switch# show spanning-tree mst 1 detail

Shows detailed information about MST instance 1

Troubleshooting Spanning Tree Protocol

Switch# debug spanning-tree all

Displays all spanning-tree debugging events

Switch# debug spanning-tree events

Displays spanning-tree debugging topology events

Switch# debug spanning-tree backbonefast

Displays spanning-tree debugging BackboneFast events

Switch# debug spanning-tree uplinkfast

Displays spanning-tree debugging UplinkFast events

Switch# debug spanning-tree mstp all

Displays all MST debugging events

Switch# debug spanning-tree switch state

Displays spanning-tree port state changes

Switch# debug spanning-tree pvst+

Displays PVST+ events

Configuration Example: PVST+

Figure 2-1 shows the network topology for the configuration of PVST+ using commands covered in this chapter. Assume that other commands needed for connectivity have already been configured. For example, all inter-switch links in this topology are configured as 802.1Q trunks.

Images

Figure 2-1 Network Topology for STP Configuration Example

Core Switch (3650)

Switch> enable

Moves to privileged EXEC mode

Switch# configure terminal

Moves to global configuration mode

Switch(config)# hostname Core

Sets the host name

Core(config)# no ip domain-lookup

Turns off Domain Name System (DNS) queries so that spelling mistakes do not slow you down

Core(config)# vtp mode server

Changes the switch to VTP server mode. This is the default mode

Core(config)# vtp domain STPDEMO

Configures the VTP domain name to STPDEMO

Core(config)# vlan 10

Creates VLAN 10 and enters VLAN configuration mode

Core(config-vlan)# name Accounting

Assigns a name to the VLAN

Core(config-vlan)# exit

Returns to global configuration mode

Core(config)# vlan 20

Creates VLAN 20 and enters VLAN configuration mode

Core(config-vlan)# name Marketing

Assigns a name to the VLAN

Core(config-vlan)# exit

Returns to global configuration mode

Core(config)# spanning-tree vlan 1 root primary

Configures the switch to become the root switch for VLAN 1

Core(config)# exit

Returns to privileged EXEC mode

Core# copy running-config startup-config

Saves the configuration to NVRAM

Distribution 1 Switch (3650)

Switch> enable

Moves to privileged EXEC mode

Switch# configure terminal

Moves to global configuration mode

Switch(config)# hostname Distribution1

Sets the host name

Distribution1(config)# no ip domain-lookup

Turns off DNS queries so that spelling mistakes do not slow you down

Distribution1(config)# vtp domain STPDEMO

Configures the VTP domain name to STPDEMO

Distribution1(config)# vtp mode client

Changes the switch to VTP client mode

Distribution1(config)# spanning-tree vlan 10 root primary

Configures the switch to become the root switch of VLAN 10

Distribution1(config)# spanning-tree vlan 10 root secondary

Configures the switch to become the secondary root switch of VLAN 20

Distribution1(config)# exit

Returns to privileged EXEC mode

Distribution1# copy running-config startup-config

Saves the configuration to NVRAM

Distribution 2 Switch (3650)

Switch>enable

Moves to privileged EXEC mode

Switch# configure terminal

Moves to global configuration mode

Switch(config)# hostname Distribution2

Sets the host name

Distribution2(config)# no ip domain-lookup

Turns off DNS queries so that spelling mistakes do not slow you down

Distribution2(config)# vtp domain STPDEMO

Configures the VTP domain name to STPDEMO

Distribution2(config)# vtp mode client

Changes the switch to VTP client mode

Distribution2(config)# spanning-tree vlan 20 root primary

Configures the switch to become the root switch of VLAN 20

Distribution2(config)# spanning-tree vlan 10 root secondary

Configures the switch to become the secondary root switch of VLAN 10

Distribution2(config)# exit

Returns to privileged EXEC mode

Distribution2# copy running-config startup-config

Saves the configuration to NVRAM

Access 1 Switch (2960)

Switch> enable

Moves to privileged EXEC mode

Switch# configure terminal

Moves to global configuration mode

Switch(config)# hostname Access1

Sets the host name

Access1(config)# no ip domain-lookup

Turns off DNS queries so that spelling mistakes do not slow you down

Access1(config)# vtp domain STPDEMO

Configures the VTP domain name to STPDEMO

Access1(config)# vtp mode client

Changes the switch to VTP client mode

Access1(config)# interface range fastethernet 0/6 - 12

Moves to interface range configuration mode

Access1(config-if-range)# switchport mode access

Places all interfaces in switchport access mode

Access1(config-if-range)# switchport access vlan 10

Assigns all interfaces to VLAN 10

Access1(config-if-range)# spanning-tree portfast

Places all ports directly into forwarding mode

Access1(config-if-range)# spanning-tree bpduguard enable

Enables BPDU Guard

Access1(config-if-range)# end

Moves back to privileged EXEC mode

Access1# copy running-config startup-config

Saves the configuration to NVRAM

Access 2 Switch (2960)

Switch> enable

Moves to privileged EXEC mode

Switch# configure terminal

Moves to global configuration mode

Switch(config)# hostname Access2

Sets the host name

Access2(config)# no ip domain-lookup

Turns off DNS queries so that spelling mistakes do not slow you down

Access2(config)# vtp domain STPDEMO

Configures the VTP domain name to STPDEMO

Access2(config)# vtp mode client

Changes the switch to VTP client mode

Access2(config)# interface range fastethernet 0/6 - 12

Moves to interface range configuration mode

Access2(config-if-range)# switchport mode access

Places all interfaces in switchport access mode

Access2(config-if-range)# switchport access vlan 20

Assigns all interfaces to VLAN 20

Access2(config-if-range)# spanning-tree portfast

Places all ports directly into forwarding mode

Access2(config-if-range)# spanning-tree bpduguard enable

Enables BPDU Guard

Access2(config-if-range)# exit

Moves back to global configuration mode

Access2(config)# spanning-tree vlan 1,10,20 priority 61440

Ensures this switch does not become the root switch for VLAN 10

Access2(config)# exit

Returns to privileged EXEC mode

Access2# copy running-config startup-config

Saves config to NVRAM

Spanning-Tree Migration Example: PVST+ to Rapid-PVST+

The topology in Figure 2-1 is used for this migration example and adds to the configuration of the previous example.

Rapid-PVST+ uses the same BPDU format as 802.1D. This interoperability between the two spanning-tree protocols enables a longer conversion time in large networks without disrupting services.

The spanning-tree features UplinkFast and BackboneFast in 802.1D-based PVST+ are already incorporated in the 802.1w-based Rapid-PVST+ and are disabled when you enable Rapid-PVST+. The 802.1D-based features of PVST+ such as PortFast, BPDU Guard, BPDU Filter, Root Guard, and Loop Guard are applicable in Rapid-PVST+ mode and need not be changed.

Access 1 Switch (2960)

Access1> enable

Moves to privileged EXEC mode

Access1# configure terminal

Moves to global configuration mode

Access1 (config)# spanning-tree mode rapid-pvst

Enables 802.1w-based Rapid-PVST+

Access1(config)# no spanning-tree uplinkfast

Removes UplinkFast programming line if it exists

Access1(config)# no spanning-tree backbonefast

Removes BackboneFast programming line if it exists

Access 2 Switch (2960)

Access2> enable

Moves to privileged EXEC mode

Access2# configure terminal

Moves to global configuration mode

Access2(config)# spanning-tree mode rapid-pvst

Enables 802.1w-based Rapid-PVST+

Distribution 1 Switch (3650)

Distribution1> enable

Moves to privileged EXEC mode

Distribution1# configure terminal

Moves to global configuration mode

Distribution1(config)# spanning-tree mode rapid-pvst

Enables 802.1w-based Rapid-PVST+

Distribution 2 Switch (3650)

Distribution2> enable

Moves to privileged EXEC mode

Distribution2# configure terminal

Moves to global configuration mode

Distribution2(config)# spanning-tree mode rapid-pvst

Enables 802.1w-based Rapid-PVST+

Core Switch (3650)

Core> enable

Moves to privileged EXEC mode

Core# configure terminal

Moves to global configuration mode

Core(config)# spanning-tree mode rapid-pvst

Enables 802.1w-based Rapid-PVST+

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.204.208