Spanning Tree Cheat Sheet

MAG212 CYBER

Spanning Tree
Ultimate Cheat Sheet

Cisco Switching • Rapid PVST+ • MST • Root Bridge • Troubleshooting & Security

Network Engineering Field Guide · October 2026

⬇ Download the PDF edition

01 STP essentials

Spanning Tree Protocol (STP) prevents Layer 2 switching loops by selecting a loop-free forwarding topology. Redundant Ethernet links remain physically present, but some logical paths discard traffic. A topology change can activate an alternate path.

ModeInstancesPurpose
802.1D STPOneLegacy, slower convergence
PVST+Per VLANCisco implementation
Rapid PVST+Per VLANRapid convergence per VLAN
RSTP (802.1w)OneStandards-based rapid tree
MST (802.1s / 802.1Q)Mapped VLAN groupsScales instances across VLANs
Configuration examples use Cisco Catalyst IOS XE syntax. Commands, defaults and supported modes vary by platform and release; verify before applying changes.

02 Root bridge, port roles and failover

The root bridge is the switch with the lowest bridge ID (priority plus extended system ID plus MAC address). Each non-root switch chooses one root port with the lowest total path cost. Every segment has a designated port; redundant paths can become alternate/discarding ports.

Rapid PVST+ VLAN 10 port rolesSW1 is the root bridge for VLAN 10. SW2 and SW3 each use their direct link to SW1 as root port. On the SW2 to SW3 link, SW2 Gi1/0/2 is the designated forwarding port and SW3 Gi1/0/2 is the alternate discarding port.MAG212 CYBER· RAPID PVST+ · VLAN 10Three-switch triangle · 1 Gb/s trunks (port cost 4) · one alternate port prevents the Layer 2 loopGi1/0/1 · DPGi1/0/1 · RPGi1/0/2 · DPGi1/0/1 · RPGi1/0/2 · DPGi1/0/2 · ALT (discarding)SW1 · ROOT BRIDGEPriority 4096 + VLAN 10 = 4106SW2 · non-rootPriority 8192 + VLAN 10 = 8202SW3 · non-rootPriority 32768 (default) + VLAN 10 = 32778ForwardingDiscarding (alternate port side)DP designated port · RP root port · ALT alternate port
Diagram assumes equal 1-Gb/s trunk costs. SW1 is root for VLAN 10; SW2 and SW3 reach it directly through their root ports. On the SW2–SW3 segment both switches advertise the same root path cost (4), so the lower sender bridge ID wins: SW2 Gi1/0/2 becomes the designated (forwarding) port and SW3 Gi1/0/2 becomes the alternate (discarding) port. Only SW3’s end of that link blocks.
Link speedShort path cost (Cisco default)Long path cost (802.1t)
10 Mb/s1002,000,000
100 Mb/s19200,000
1 Gb/s420,000
10 Gb/s22,000

Use the same path-cost method on every switch (spanning-tree pathcost method long if you need to distinguish links faster than 10 Gb/s).

If SW3 loses its forwarding link to SW1, RSTP can rapidly transition its alternate port toward SW2. Actual convergence depends on topology and platform behavior.

03 Per-VLAN load balancing

Root bridge placement per VLANVLAN 10 uses SW1 as root and blocks SW3 port toward SW2. VLAN 20 uses SW2 as root and blocks SW3 port toward SW1, so both uplinks carry traffic.ROOT BRIDGE PLACEMENT PER VLANDifferent roots per VLAN put both of SW3’s uplinks to work · equal 1 Gb/s costs assumedVLAN 10 · SW1 is rootSW1 · ROOTSW2SW3priority SW1 4096 · SW2 8192 · SW3 32768 · SW3 port toward SW2 is alternateVLAN 20 · SW2 is rootSW1SW2 · ROOTSW3priority SW1 8192 · SW2 4096 · SW3 32768 · SW3 port toward SW1 is alternate

Configure SW1 as root for VLAN 10 and SW2 as root for VLAN 20. This gives different VLANs different preferred Layer 2 roots. Plan gateway placement and uplink utilization together; a root bridge is not automatically the default gateway.

! SW1
conf t
spanning-tree mode rapid-pvst
spanning-tree vlan 10 priority 4096
spanning-tree vlan 20 priority 8192
end
! SW2
conf t
spanning-tree mode rapid-pvst
spanning-tree vlan 10 priority 8192
spanning-tree vlan 20 priority 4096
end
Choose priority values in increments of 4096. A lower value wins unless an even lower bridge ID is advertised.

04 Edge protection and trunk hardening

Use PortFast only on verified endpoint-facing ports. BPDU Guard shuts down an edge port that receives an unexpected BPDU, helping contain accidental loops and rogue switches. Root Guard protects a designated port from an unexpected superior root advertisement. Loop Guard protects non-designated/root path conditions when BPDUs disappear.

! Confirm these are host-only access ports
interface range GigabitEthernet1/0/10-24
 switchport mode access
 spanning-tree portfast
 spanning-tree bpduguard enable
! Designated downlink to an access switch, not an uplink to root
interface GigabitEthernet1/0/3
 spanning-tree guard root
! Optional network-wide loop protection (validate design first)
spanning-tree loopguard default
Do not combine root guard and loop guard on the same interface. Avoid unreviewed BPDU filter on production ports; suppressing BPDUs can hide loops. Do not enable edge PortFast indiscriminately on switch trunks.

05 MST configuration and region consistency

MST maps many VLANs to a small number of spanning-tree instances. Switches in the same MST region must match region name, revision, and VLAN-to-instance mappings. A mismatch creates a boundary and can produce surprising forwarding behavior.

spanning-tree mode mst
spanning-tree mst configuration
 name MAG212-CAMPUS
 revision 5
 instance 1 vlan 10,30
 instance 2 vlan 20,40
 exit
spanning-tree mst 1 priority 4096
spanning-tree mst 2 priority 8192
! Verify
show spanning-tree mst configuration
show spanning-tree mst detail
Plan MST-to-Rapid-PVST interoperability before deployment. Region boundary and PVST simulation inconsistencies need special attention.

06 Critical verification commands

CommandWhat it tells you
show spanning-tree summaryActive mode and global statistics
show spanning-tree vlan 10Root ID, local bridge ID, ports and states
show spanning-tree rootRoot bridge per instance
show spanning-tree interface gi1/0/1 detailRole, state, BPDU counters
show spanning-tree inconsistentportsRoot/loop/PVST inconsistency blocking
show interfaces trunkAllowed VLANs and operational trunks
show etherchannel summaryBundle consistency if trunks are aggregated
show logging | include SPANTREE|BPDUTopology events and guard violations
SW3# show spanning-tree vlan 10
VLAN0010
  Root ID    Priority    4106
             Address     0011.2233.4400
             Cost        4
             Port        1 (Gi1/0/1)
  Bridge ID  Priority    32778
Interface           Role Sts Cost
Gi1/0/1            Root FWD 4
Gi1/0/2            Altn BLK 4
Output is illustrative, not a captured device result. Rapid PVST+ often displays BLK for an alternate/discarding port.

07 Troubleshooting playbook

SymptomCheckLikely action
Frequent topology changesshow spanning-tree detail; interface countersFind flapping or unmanaged bridge
Wrong root bridgeRoot ID and priority per VLANSet deterministic root priorities
Host port err-disabledshow logging and interface statusRemove rogue switch/loop before recovery
Traffic blackhole on trunkVLAN allowance, state, native VLANFix trunk or STP inconsistency
MST neighbors disagreeRegion name/revision/VLAN mappingAlign region configuration
Unidirectional linkLoop guard, optics, UDLD statusReplace faulty link, validate guards

Change-control sequence: capture baseline, change one switch or VLAN group at a time, verify root IDs and port roles, then simulate one approved link failure during a maintenance window.

08 Practice Q&A

Q1. SW1 priority 4096 and SW2 priority 8192 in VLAN 10. Who wins?

SW1, assuming normal extended system ID behavior; its effective bridge priority is lower.

Q2. Does the root bridge have a root port?

No. The root is the reference point; its participating ports are designated on their attached segments.

Q3. Why can an RSTP port be discarding while the cable is up?

To prevent a forwarding loop while preserving a backup path.

Q4. PortFast and BPDU Guard together?

Appropriate on verified host-facing switchports; not a blanket trunk setting.

Q5. What must match in an MST region?

Region name, revision and VLAN-to-instance mappings.

Q6. Can root guard and loop guard coexist on the same interface?

No; Cisco documents them as mutually exclusive on an interface.

Q7. Is a router IP subnet required for an L2 STP trunk?

No. STP operates on bridge ports at Layer 2; VLAN IDs, interface roles and path costs are the meaningful labels.

Q8. Why is a 2-Way OSPF concept irrelevant here?

STP uses BPDU/bridge and port roles, not Layer 3 routing adjacency states.

09 Sources & further reading

This is an original MAG212 CYBER guide: all diagrams, examples and explanations were written independently. The topic coverage was inspired by the classic PacketLife.net Spanning Tree cheat sheet.

Standards and vendor references: IEEE 802.1D (STP), 802.1w (RSTP) and 802.1s/802.1Q (MST); Cisco — Understanding Rapid Spanning Tree Protocol (802.1w); Cisco — Troubleshoot STP Problems and Related Design Considerations. Verify syntax against your platform and software release before applying changes.

© 2026 MAG212 CYBER · cyber.mag212.com · Original illustrations · Technical reference
More guides in Learn · Routing protocols compared · Network consulting & seminars