Courseiva
Spanning TreeGlobal Config

spanning-tree mode [pvst|rapid-pvst|mst]

Configures the Spanning Tree Protocol (STP) mode on a Cisco switch to either Per-VLAN Spanning Tree (PVST+), Rapid PVST+, or Multiple Spanning Tree (MST) to prevent Layer 2 loops.

Definition: spanning-tree mode [pvst|rapid-pvst|mst] is a Cisco IOS global config command. Configures the Spanning Tree Protocol (STP) mode on a Cisco switch to either Per-VLAN Spanning Tree (PVST+), Rapid PVST+, or Multiple Spanning Tree (MST) to prevent Layer 2 loops.

Overview

The `spanning-tree mode` command is a critical configuration on Cisco switches that determines which variant of the Spanning Tree Protocol (STP) the switch will use to prevent Layer 2 loops in Ethernet networks. STP is a foundational networking protocol that ensures a loop-free topology by dynamically blocking redundant paths. Without STP, broadcast storms, multiple frame copies, and MAC address table instability can render a network unusable.

This command allows network engineers to select between Per-VLAN Spanning Tree (PVST+), Rapid PVST+, or Multiple Spanning Tree (MST). PVST+ is Cisco's proprietary enhancement of the original IEEE 802.1D STP, running a separate instance per VLAN. Rapid PVST+ is based on IEEE 802.1w, providing faster convergence (typically 1-2 seconds vs. 30-50 seconds for PVST+).

MST (IEEE 802.1s) maps multiple VLANs to a smaller number of spanning-tree instances, reducing CPU and bandwidth overhead in large networks with many VLANs. The choice of mode depends on network size, convergence requirements, and interoperability needs. For small to medium networks with few VLANs, PVST+ is simple and sufficient.

For networks requiring fast convergence, Rapid PVST+ is preferred. In large networks with hundreds of VLANs, MST is more efficient because it reduces the number of spanning-tree instances. This command is typically one of the first STP-related configurations applied to a switch, often followed by tuning parameters like priority, port cost, and portfast.

It is configured in global configuration mode and requires privilege level 15. The change takes immediate effect and is written to the running configuration. It is important to note that all switches in the same Layer 2 domain should run the same STP mode to avoid interoperability issues.

For example, mixing PVST+ and MST can cause unexpected blocking or forwarding behavior. The command does not require a reload, but changing from PVST+ to MST or vice versa may cause a temporary topology change as the switch recalculates spanning tree. In IOS, the default mode is PVST+ on most platforms.

The command is supported on all Cisco switches running IOS, IOS-XE, and some NX-OS platforms. Understanding this command is essential for CCNA and CCNP candidates as it directly impacts network stability and convergence.

Syntax·Global Config
spanning-tree mode [pvst|rapid-pvst|mst]

When to Use This Command

  • Migrating from legacy PVST+ to Rapid PVST+ for faster convergence in a network with redundant links.
  • Enabling MST to reduce STP overhead by grouping multiple VLANs into a single spanning tree instance.
  • Configuring PVST+ on a switch that needs to interoperate with older Cisco switches that do not support rapid or MST.
  • Standardizing all switches in a data center to Rapid PVST+ for sub-second convergence during link failures.

Parameters

ParameterSyntaxDescription
pvstpvstSelects Per-VLAN Spanning Tree (PVST+) mode. This is the default on most Cisco switches. It runs a separate instance of IEEE 802.1D STP for each VLAN, allowing per-VLAN root bridge selection and load balancing. However, convergence is slow (30-50 seconds) and CPU overhead increases with the number of VLANs.
rapid-pvstrapid-pvstSelects Rapid PVST+ mode, based on IEEE 802.1w RSTP. It provides faster convergence (typically 1-2 seconds) while maintaining per-VLAN instances. This is the recommended mode for most modern networks that do not require MST. It is backward compatible with PVST+ but requires all switches to run rapid-pvst for full benefit.
mstmstSelects Multiple Spanning Tree (MST) mode, based on IEEE 802.1s. It allows mapping multiple VLANs to a single spanning-tree instance, reducing the number of instances. MST requires configuration of the MST region (name, revision number, and VLAN-to-instance mapping). It is ideal for large networks with many VLANs.

Command Examples

Enable Rapid PVST+ on a switch

spanning-tree mode rapid-pvst

No output is generated by this command. Use 'show spanning-tree' to verify the mode.

Enable MST and enter MST configuration

spanning-tree mode mst

After entering global config, this command enables MST. Then use 'spanning-tree mst configuration' to configure MST instances.

Understanding the Output

This command does not produce output directly. To verify the STP mode, use 'show spanning-tree' or 'show spanning-tree summary'. In 'show spanning-tree summary', look for the 'Mode' field which will display either 'PVST+', 'Rapid-PVST', or 'MST'.

For PVST+, the output shows per-VLAN STP information. For Rapid PVST+, the port roles (Root, Designated, Alternate, Backup) and states (Forwarding, Learning, Discarding) are shown. For MST, the output includes MST instance IDs and their associated VLANs.

Key fields: 'Root ID' shows the root bridge MAC and priority; 'Bridge ID' shows the local switch; 'Port' indicates the interface; 'Role' and 'State' indicate the port's STP role and forwarding state. A healthy network should have all ports in a forwarding state (except those blocked by STP) and a single root bridge per VLAN or instance.

Configuration Scenarios

Configure Rapid PVST+ on a pair of access switches

A small office network has two Cisco 2960 switches connected by a trunk link. The network has 10 VLANs and requires fast convergence to minimize downtime during link failures. The goal is to enable Rapid PVST+ on both switches.

Topology

SW1(Gi0/1)---trunk---(Gi0/1)SW2 SW1 and SW2 each have access ports in VLANs 10-19

Steps

  1. 1.Step 1: Enter global configuration mode on SW1: SW1> enable, SW1# configure terminal
  2. 2.Step 2: Set the spanning-tree mode to rapid-pvst: SW1(config)# spanning-tree mode rapid-pvst
  3. 3.Step 3: (Optional) Configure the root bridge for VLAN 10: SW1(config)# spanning-tree vlan 10 root primary
  4. 4.Step 4: Repeat steps 1-3 on SW2.
  5. 5.Step 5: Verify the configuration: SW1# show spanning-tree vlan 10
Configuration
! SW1 configuration
spanning-tree mode rapid-pvst
spanning-tree vlan 10 root primary
! SW2 configuration
spanning-tree mode rapid-pvst

Verify: Use 'show spanning-tree vlan 10' on SW1. Expected output shows 'Spanning tree enabled protocol rstp' and the root bridge should be SW1 (if root primary configured).

Watch out: If one switch is left in default PVST+ mode, the rapid-pvst switch will fall back to PVST+ on that link, negating fast convergence. Ensure all switches in the VLAN are configured for rapid-pvst.

Configure MST with two instances for VLAN load balancing

A campus network has 50 VLANs across multiple distribution and access switches. To reduce spanning-tree overhead, the network engineer wants to use MST with two instances: instance 1 for VLANs 1-100 and instance 2 for VLANs 101-200. The MST region name is 'CAMPUS' with revision 1.

Topology

Dist1---Dist2 (trunk) Dist1 connects to Access1, Access2; Dist2 connects to Access3, Access4

Steps

  1. 1.Step 1: Enter global configuration mode on Dist1: Dist1# configure terminal
  2. 2.Step 2: Configure MST region: Dist1(config)# spanning-tree mst configuration, Dist1(config-mst)# name CAMPUS, Dist1(config-mst)# revision 1
  3. 3.Step 3: Map VLANs to instances: Dist1(config-mst)# instance 1 vlan 1-100, Dist1(config-mst)# instance 2 vlan 101-200, Dist1(config-mst)# exit
  4. 4.Step 4: Set the spanning-tree mode to mst: Dist1(config)# spanning-tree mode mst
  5. 5.Step 5: Configure root bridge for instance 1: Dist1(config)# spanning-tree mst 1 root primary
  6. 6.Step 6: Repeat on all other switches with identical MST region configuration.
  7. 7.Step 7: Verify: Dist1# show spanning-tree mst 1
Configuration
! Dist1 configuration
spanning-tree mst configuration
 name CAMPUS
 revision 1
 instance 1 vlan 1-100
 instance 2 vlan 101-200
spanning-tree mode mst
spanning-tree mst 1 root primary

Verify: Use 'show spanning-tree mst 1' to verify the instance is active and root bridge is Dist1. Also use 'show spanning-tree mst configuration' to confirm region settings match on all switches.

Watch out: All switches in the MST region must have identical region name, revision number, and VLAN-to-instance mapping. A mismatch can cause the switches to treat each other as separate regions, leading to incorrect blocking.

Troubleshooting with This Command

When troubleshooting spanning-tree issues, the `show spanning-tree` command (and its variants) is the primary diagnostic tool. After configuring the mode, verify that the expected protocol is running. For rapid-pvst, look for 'Spanning tree enabled protocol rstp' in the output.

For mst, look for 'Spanning tree enabled protocol mstp'. If the output shows 'ieee' (802.1D) when rapid-pvst was configured, it indicates the switch is falling back due to a neighbor running PVST+. Common symptoms that this command helps diagnose include: unexpected port blocking, slow convergence after link failure, or high CPU utilization due to excessive spanning-tree topology changes.

A healthy output for rapid-pvst shows all ports in forwarding or blocking state as expected, with consistent root bridge information. Problem indicators include: ports stuck in listening/learning for extended periods, inconsistent root bridge IDs across switches, or 'Topology Change' flags incrementing rapidly. The step-by-step diagnostic flow: 1) Verify the STP mode on all switches with `show spanning-tree summary`. 2) Check the root bridge for each VLAN or instance with `show spanning-tree root`. 3) Examine port roles and states with `show spanning-tree interface <interface>`. 4) If ports are unexpectedly blocking, check for BPDU guard, root guard, or loop guard configurations. 5) Use `debug spanning-tree events` (with caution) to see real-time topology changes.

Correlate with `show logging` to see STP-related syslog messages. For MST, ensure the region configuration is consistent; use `show spanning-tree mst configuration` to compare. If the switch is not participating in MST correctly, it may be in 'PVST simulation' mode, which can cause issues.

Also, check the `spanning-tree mst hello-time`, `forward-time`, and `max-age` timers if convergence is slow. In large networks, high CPU due to STP can be mitigated by using MST to reduce instances. Always ensure that the STP mode matches the network design; mixing modes can lead to loops or suboptimal paths.

CCNA Exam Tips

1.

CCNA exam expects you to know that Rapid PVST+ is the default on newer Cisco switches (IOS 15.0 and later).

2.

Remember that MST requires a region name and revision number to match across switches; mismatched MST configurations can cause loops.

3.

The exam may test that PVST+ is Cisco proprietary and runs one STP instance per VLAN, while MST is IEEE 802.1s and can map multiple VLANs to fewer instances.

4.

Know that 'spanning-tree mode mst' alone does not configure MST instances; you must also enter MST configuration mode to map VLANs.

Common Mistakes

Forgetting to configure the same MST region name and revision on all switches in the MST region, causing them to treat each other as separate regions.

Assuming that changing the STP mode is hitless; in production, changing mode can cause a temporary topology change and traffic disruption.

Using 'spanning-tree mode pvst' on a switch that needs rapid convergence, resulting in slow (30-50 second) convergence on link failures.

spanning-tree mode [pvst|rapid-pvst|mst] vs show spanning-tree

These two commands are commonly paired because 'spanning-tree mode' configures the STP variant on the switch, while 'show spanning-tree' displays the resulting STP state. Understanding both is essential for managing STP—the former sets the protocol behavior, and the latter verifies its operation.

Aspectspanning-tree mode [pvst|rapid-pvst|mst]show spanning-tree
ScopeConfigures STP mode globally per deviceDisplays STP state per VLAN or all VLANs
Configuration modeGlobal Configuration modePrivileged EXEC mode
PersistenceWrites to running-config (requires save)Displays current state, no persistence
Typical useInitial setup or switching STP variantTroubleshooting and verification
PrecedenceMust be set before per-VLAN tuningShows resulting root bridge and port roles

Use spanning-tree mode [pvst|rapid-pvst|mst] when initially configuring STP or migrating between STP variants to ensure consistent loop prevention behavior.

Use show spanning-tree when verifying STP state, identifying the root bridge, checking port roles, or troubleshooting Layer 2 loops.

Platform Notes

On IOS-XE (e.g., Catalyst 9000 series), the command syntax is identical to classic IOS: `spanning-tree mode {pvst | rapid-pvst | mst}`. However, IOS-XE may have additional features like 'spanning-tree mode pvst' being the default. The output of `show spanning-tree` is similar but may include additional fields like 'Operational mode' and 'Port type'.

On NX-OS (e.g., Nexus 9000), the equivalent command is `spanning-tree mode {pvst | rapid-pvst | mst}` as well, but NX-OS uses a different default (typically rapid-pvst on some platforms). Additionally, NX-OS supports 'spanning-tree mst configuration' with similar subcommands. On ASA firewalls, spanning-tree is not typically used because ASAs operate at Layer 3; however, if bridging is configured (e.g., in transparent firewall mode), the command is not available.

For IOS-XR (e.g., ASR 9000), spanning-tree is not supported in the same way; instead, Ethernet networks use protocols like Ethernet Ring Protection (ERP) or REP. The command does not exist in IOS-XR. Between IOS versions, the behavior is consistent, but older IOS 12.x may have limited MST support (e.g., 12.2(25)SEC introduced MST).

Always check the specific platform documentation. When upgrading from older IOS to IOS-XE, the configuration is backward compatible, but it's recommended to review STP parameters. For CCNA/CCNP studies, focus on IOS and IOS-XE as they are most common in exam environments.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions