Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

STP (Spanning Tree Protocol)

Direct answer

Spanning tree (802.1D, and its faster versions RSTP and MST) prevents Layer 2 loops by electing one root bridge, choosing one best path from every switch to the root, and blocking the redundant ports. Cisco runs a separate tree per VLAN (PVST+ / Rapid PVST+) by default.

When to use this

Use it when there are broadcast storms or MAC flapping, traffic takes an unexpected path, or links block or go down after a topology change.

First 30 seconds

1. show spanning-tree root — is the root the intended switch for this VLAN?

2. show spanning-tree vlan <id> — root port and blocked ports where the design expects them?

3. show spanning-tree vlan <id> detail | include ieee|occurr|from — recent topology changes, and the port they came from?

4. show spanning-tree inconsistentports — any port held by a guard?

5. Storm or MAC flapping → find the port that should block but forwards; check unidirectional links and BPDU filter.

Operational verification

bridge IDs compared → root elected → each switch picks its lowest-cost root port → one designated port per segment → remaining ports block → loop-free forwarding tree per VLAN

Failure signatureTraffic takes a suboptimal path because the wrong switch became STP root

Traffic between access switches hairpins through an unexpected switch; uplinks to the intended distribution switch are blocking.

Possible stored cause: Root bridge election was left to defaults (lowest MAC), so an access or old switch became root for the VLAN.
Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Treating every blocking/discarding port as a fault.

- Checking STP globally instead of the affected VLAN/instance.

- Changing cost/priority before confirming which root is actually elected.

- Ignoring Root Guard/Loop Guard/BPDU Guard states.

- Troubleshooting MAC/ARP before proving STP forwarding on the path.

- Assuming a physical link up/up means STP allows data forwarding.

Platform / version applicability
Cisco IOS / IOS XE
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCisco IOS / IOS XE · Cisco IOS XE
Scope / prerequisiteUse it when there are broadcast storms or MAC flapping, traffic takes an unexpected path, or links block or go down aft…
What next?3 suggested next steps
Child topics (this level)4
Evidence1
On this pageJump to a specific section
Technical verification guide · documented only

Check the correct boundary

STP root election, per-instance port role and port state control Layer-2 forwarding. An alternate or discarding port can be correct.

Use the selected VLAN or MST instance and compare intended root with the live bridge. The example below uses VLAN-scoped IOS/IOS XE syntax.

Read-only example / checkInterpretationDoes not prove
show spanning-tree vlan <vlan-id>
Root ID, local bridge and port roles/states for the VLAN STP forwarding does not prove trunk VLAN carriage, MAC learning or L3 reachability

Official documentation

Documentation reviewed 12 October 2026. These are explanatory reference examples, not observed production state, captured Evidence, or a new stored verification event. Confirm exact software release and scope on the device.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

4 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Traffic between access switches hairpins through an unexpected switch; uplinks to the intended distribution switch are blocking.

Step 1 Layered verification Verify boundary

Compare root ID, cost, role and state on both ends; validate VLAN/MST mapping and MAC movement for the test host, then test the original Layer-2 flow.

Step 2 Verification and output interpretation Verify boundary

Use show spanning-tree or the VLAN/instance-specific form to identify the root bridge, local root path cost, port roles and forwarding/discarding states. Verify the root ID is the intended device, the root port points toward the expected upstream path, designated ports own their segments and alternate/blocking roles correspond to deliberate redundancy. Compare both ends of a suspicious link when role interpretation is unclear. During a controlled failover, verify that an alternate path transitions as designed and that the resulting forwarding topology still matches the intended root placement.

Step 3 Verification & troubleshooting Narrow the fault
SymptomCommandLook forNext check
Unexpected rootshow spanning-tree rootIntended switch is root for each VLANSet spanning-tree vlan <list> priority on the intended root
Port blockingshow spanning-tree vlan <id>Role Altn is expected on redundant linksPath cost and port priority if the wrong port blocks
Port err-disabledshow interfaces status err-disabledCause such as bpduguardA switch connected to a PortFast/BPDU Guard port
Topology changesshow spanning-tree detail \| include ieee\|occurr\|fromNumber and source of TCNsFlapping edge port without PortFast
Step 4 Where it fails Narrow the fault

Typical failure order: link or trunk down, or the VLAN not allowed on the trunk → BPDUs not received (BPDU Filter, unidirectional link) → wrong root because no priority was set → wrong port blocking because of cost or an unbundled EtherChannel → port err-disabled by BPDU Guard or held inconsistent by Root/Loop Guard → constant topology changes from an edge port without PortFast, flushing MAC tables → STP correct, but MAC learning or the FHRP gateway placement causes the symptom.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Command lookup Jump straight to Cisco syntax
Drill down

Subtopics

Go one level deeper into this subject.

Key points

Election order: lowest bridge ID wins root; each non-root switch picks the port with the lowest cost to the root (root port); each segment has one designated port; the rest block. Tie-breakers: root path cost, sender bridge ID, sender port priority, sender port number. Place the root deliberately with priority — never leave it to the lowest MAC address.

Key checks
  • show spanning-tree vlan <id> — root ID, local bridge ID, and each port's role, state and cost.
  • show spanning-tree root — the root bridge, root cost and root port per VLAN.
  • show spanning-tree vlan <id> detail — BPDUs sent and received, topology changes and their source.
  • show spanning-tree summary — mode, enabled features and port counts per state.
  • show spanning-tree inconsistentports — ports blocked by root guard, loop guard or type inconsistency.
ReferenceWhat it is1 section · depth on demand

What it is

Spanning Tree prevents Layer 2 loops by electing one root bridge and putting redundant ports into a non-forwarding state.

  • 802.1D (classic STP): slow convergence (up to 30–50 seconds).
  • PVST+ / Rapid PVST+ (Cisco default on Catalyst): one tree per VLAN; Rapid PVST+ uses 802.1w RSTP and converges in about a second on point-to-point links.
  • MST (802.1s): maps many VLANs to a few instances.

Port roles: root, designated, alternate and backup. RSTP port states: discarding, learning, forwarding.

ReferenceWhy it matters1 section · depth on demand

Why it matters

Without STP, a Layer 2 loop causes broadcast storms, MAC table flapping and a network outage within seconds. A blocking port in a redundant design is therefore normal; the question is whether the intended switch is root and the intended ports block.

ReferenceHow it works1 section · depth on demand

How STP chooses a loop-free topology

For each VLAN (PVST+) or instance (MST), switches exchange BPDUs and compare, in order: root Bridge ID → root path cost → sender Bridge ID → sender port ID. The lowest value wins at each step.

With Rapid PVST+, a designated port on a point-to-point link sends a proposal, the neighbour syncs its other ports and returns an agreement, and the link forwards within about a second instead of waiting for the listening/learning timers. Edge ports (PortFast) forward immediately.

ReferenceImportant terms & boundaries5 sections · depth on demand

Key points

  • Root bridge: lowest Bridge ID (priority + VLAN ID extension + MAC) wins. Default priority is 32768.
  • Root port: each non-root switch picks the port with the lowest cost to the root; ties go to the lowest sender Bridge ID, then the lowest sender port ID.
  • Designated port: one forwarding port per segment, toward the leaves.
  • Alternate/backup: redundant ports that discard until a failure.
  • Default costs (short method): 10 Mb/s = 100, 100 Mb/s = 19, 1 Gb/s = 4, 10 Gb/s = 2.
  • Troubleshoot per VLAN or MST instance: root → path cost → role → state → protection feature.

In depth

Spanning tree keeps a redundant Layer 2 network loop-free

Ethernet frames have no hop limit, so a physical loop makes broadcasts circulate until the network fails. Spanning tree blocks redundant ports so there is exactly one active path between any two points, and unblocks them when the active path fails.

Modes on Catalyst 9300 (from the STP guide)

ModeStandardInstances
PVST+IEEE 802.1D with Cisco extensionsOne per VLAN
Rapid PVST+ (default)IEEE 802.1wOne per VLAN; up to 300 instances (from 17.2.1)
MSTPIEEE 802.1sUp to 65 instances, with any number of VLANs mapped to each

STP is enabled on VLAN 1 and on every new VLAN by default.

C9300(config)# spanning-tree mode rapid-pvst
C9300(config)# spanning-tree vlan 10,20 root primary
C9300(config)# spanning-tree portfast default
C9300(config)# spanning-tree portfast bpduguard default
C9300# show spanning-tree vlan 10
VLAN0010
  Spanning tree enabled protocol rstp
  Root ID    Priority    24586
             Address     a4bb.6d11.2200
             Cost        2
             Port        2081 (Port-channel10)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     a4bb.6d33.4400
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Po10                Root FWD 2         128.2081 P2p
Po11                Altn BLK 2         128.2082 P2p
Gi1/0/10            Desg FWD 4         128.10   P2p Edge
C9300# show spanning-tree summary

Documented defaults

SettingDefault
Bridge priority32768, set in steps of 4096
Port priority128, steps of 16
Path cost (short method)10 Mb/s 100, 100 Mb/s 19, 1 Gb/s 4, 10 Gb/s 2, 25 and 40 Gb/s 1
TimersHello 2 s, forward delay 15 s, max age 20 s, transmit hold count 6

Design rules

RuleReason
Choose the root deliberately (distribution or core)The default election picks the lowest MAC, often the oldest switch
Align root with the FHRP active gateway per VLANKeeps traffic off the inter-switch link
PortFast and BPDU guard on access portsFast host connectivity and protection against rogue switches
Prefer EtherChannel and Layer 3 designsFewer blocked links and smaller failure domains

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Protection features

FeatureApplied onActionPrevents
PortFastAccess/edge portsSkips listening/learningSlow host start-up and needless TCNs
BPDU GuardPortFast portsErr-disables the port if a BPDU arrivesA switch plugged into a user port
BPDU FilterRarely, edge portsStops sending/processing BPDUsUse with care: can create loops
Root GuardDistribution ports toward accessPuts the port in root-inconsistent state on a superior BPDUAn access switch becoming root
Loop GuardRoot and alternate portsPuts the port in loop-inconsistent state if BPDUs stopUnidirectional link loops
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Concept and state model

Spanning Tree compares bridge and path information carried in BPDUs. The lowest Bridge ID becomes root; each non-root switch selects a root port representing its best path toward the root; each segment selects a designated port; and redundant alternatives remain non-forwarding until needed. Path decisions compare the root ID, accumulated root-path cost, sender bridge ID and sender port ID in a deterministic sequence. RSTP improves convergence by adding explicit alternate roles and proposal/agreement behavior, but the core design question remains the same: which links should forward for a given spanning-tree instance and which should provide redundancy. STP is a control plane for Layer 2 topology, not a bandwidth aggregation mechanism.

Operational boundaries and common misconceptions

A blocking/discarding port is often evidence that STP is working, not evidence of a failed link. A root bridge does not automatically forward user traffic as a gateway; it is a Layer 2 control-plane role. Interface up/down state and STP forwarding state are separate facts. Unexpected topology changes can be caused by real link transitions, misconfigured edge behavior, new switches/BPDUs or unstable physical members. Avoid treating a topology-change counter alone as root cause; correlate the timing with actual port and topology events.

ReferenceConfiguration & state2 sections · depth on demand

Configuration example (Cisco IOS XE)

spanning-tree mode rapid-pvst
spanning-tree vlan 10,20 root primary          ! on DIST-1 (sets priority 24576)
spanning-tree vlan 30,40 root secondary        ! on DIST-1 (28672)
!
interface range GigabitEthernet1/0/1 - 24
 switchport mode access
 spanning-tree portfast
 spanning-tree bpduguard enable
!
interface GigabitEthernet1/0/48
 description Downlink to access switch
 spanning-tree guard root
!
errdisable recovery cause bpduguard
errdisable recovery interval 300

root primary is a macro that computes a priority at configuration time; a fixed spanning-tree vlan 10 priority 4096 is more predictable. Documented example, not captured output.

Configuration model and design choices

A stable design places the root bridge intentionally rather than accepting whichever switch wins by default MAC/priority. Set bridge priority so primary and secondary root placement aligns with Layer 3 gateways and traffic paths. Use PortFast only on true edge ports where immediate forwarding is appropriate, and pair it with protections such as BPDU Guard when the design requires an edge port to reject unexpected bridge participation. Root Guard and Loop Guard solve different control-plane risks and should be applied according to topology intent rather than globally as interchangeable “STP security” knobs. On redundant links, coordinate STP design with EtherChannel so links intended to act as one logical path are bundled rather than individually blocked.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCisco IOS / IOS XE Current documentation reviewed 2026-09-14

Authoritative/upstream documentation reviewed for bounded claims in Switching → STP. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%
2026-09-13 · vendor docCisco Catalyst 9000 / IOS XE current

Official Cisco vendor documentation reviewed for bounded reference claims: STP topology, role/state and PVST+/Rapid-PVST+ concepts. This is documentation-based technical verification, not lab or production-runtime proof. Deployment-specific applicability and runtime outcome remain separate evidence.

Basis: https://www.cisco.com/c/en/us/td/docs/switches/lan/c9000/lyr2-fwd/stp/stp-configuration-guide/m-stp.html · confidence 94%
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
spanning tree protocol
Embedded reference data

Quick lookup tables

STP troubleshooting boundary map

Fast order for isolating a spanning-tree path problem

QuestionCommand / evidence
Which VLAN/instance is affected?show spanning-tree vlan <vlan> / MST mapping
Who is root?Root ID + show spanning-tree root
Which path wins?Root path cost + Root port
Why does this link not forward?Port role + state + interface detail
Is a guard feature intervening?show spanning-tree inconsistentports, err-disable/logs
STP is forwarding but traffic fails?trunk/VLAN/MAC/ARP/L3 evidence

STP roles and forwarding states

Fast reference for root election and common port roles.

ItemMeaning
Root bridgeLowest Bridge ID wins the election
Root portBest path toward the root on a non-root switch
Designated portForwarding port selected for a segment
Alternate portRedundant path kept non-forwarding to avoid loops
DiscardingDoes not forward user frames
LearningLearns source MAC addresses but does not yet forward user frames
ForwardingLearns and forwards user traffic

STP · reference boundaries

Compact technical reference for the most important state and interpretation boundaries.

STP conceptMeaningHealthy reference
Root bridgeLowest elected Bridge IDIntended distribution/core switch owns root
Root portBest local path to rootPoints toward intended upstream path
Designated portBest port for a segmentForwards on the segment
Alternate/non-forwardingRedundant pathAvailable without creating a loop
Embedded quick reference

Operational notes

Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.

STP Fast Check

Root, role, state og path-cost i kompakt form.

Quick checks

1. show spanning-tree root

2. show spanning-tree vlan <vlan>

3. Find the root port and designated ports

4. Confirm blocking/alternate ports are where you expect them

5. Check PortFast/BPDU Guard on access ports

Red flags

  • Unexpected root bridge
  • Root port keeps changing
  • Access port with PortFast connected to a switch
  • Inconsistent / err-disabled state

STP troubleshooting cheat sheet

Root → roles → path → protections

1. Identify the VLAN/instance and intended root.

2. Compare Root ID and Bridge ID.

3. Follow root ports and path cost toward the root.

4. Identify designated/alternate roles.

5. Check Root Guard, BPDU Guard, Loop Guard and topology changes when relevant.

A blocked redundant port can be perfectly healthy.

Depth when you need it

Deep reference

Healthy vs suspicious evidence

Reading show spanning-tree vlan

Illustrative output, not captured Evidence:

VLAN0010
  Root ID    Priority    24586
             Address     00a1.b2c3.d400
             Cost        4
             Port        49 (GigabitEthernet1/0/49)
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)

Interface           Role Sts Cost      Prio.Nbr Type
Gi1/0/49            Root FWD 4         128.49   P2p
Gi1/0/50            Altn BLK 4         128.50   P2p
Gi1/0/1             Desg FWD 4         128.1    P2p Edge

Root priority 24586 = 24576 + VLAN 10. This switch is not root (its Bridge ID is higher). Gi1/0/50 is the redundant uplink and should be Altn BLK. Edge confirms PortFast.

Confirmation

Confirm action

Continue?