Spanning Tree (STP)
Spanning Tree Protocol (STP) is the Layer 2 safety mechanism that lets you build redundant switch links without collapsing the network under a broadcast storm. This hub gathers the core concepts, a step-by-step RSTP configuration guide, a command cheat sheet, and hands-on graded labs so you can move from understanding loop prevention to proving you can configure and verify it.
New to this? Start with the explainer: What Is Spanning Tree Protocol (STP)?
Ethernet frames have no TTL field, so a single Layer 2 loop lets frames — especially broadcasts — circulate forever, saturating links and thrashing MAC address tables. STP (IEEE 802.1D) solves this by electing a single reference switch and logically blocking every redundant path back to it, leaving one loop-free active topology while keeping the blocked links in reserve as backups. Because redundancy is standard in any real campus design, STP behavior, tuning, and edge protection are core CCNA switching material and a frequent source of hard-to-diagnose outages in the field.
The process starts with root bridge election. Every switch advertises a Bridge ID — a bridge priority (default 32768, adjustable only in increments of 4096) followed by its MAC address — inside BPDUs, and the switch with the lowest Bridge ID becomes the root, with ties broken by the lowest MAC address. On Cisco Catalyst switches this runs per VLAN (PVST+ or Rapid PVST+, depending on platform and version), so the priority field carries the VLAN ID via the extended system ID and you can steer the root per VLAN. You rarely rely on the default election; instead you lower the priority on the switch you want as root, which the RSTP configuration guide walks through end to end.
Once the root is chosen, each non-root switch selects one root port (the lowest-cost path toward the root, breaking ties on sender Bridge ID then port ID), each segment elects one designated port, and the remaining ports are blocked. Path cost is driven by link bandwidth — in the classic short-cost scheme, 100 Mbps = 19, 1 Gbps = 4, and 10 Gbps = 2 — so adjusting per-port cost or priority is how you influence which redundant link forwards and which one blocks.
Port states are the other half of the map. Legacy 802.1D ports move through blocking, listening, learning, and forwarding, governed by timers (hello 2s, forward delay 15s, max age 20s) that make convergence take roughly 30–50 seconds. Rapid STP (802.1w, delivered on Cisco as Rapid PVST+) collapses those into just discarding, learning, and forwarding, adds the alternate and backup port roles, and uses a proposal/agreement handshake to converge in about a second on point-to-point links. Understanding how RSTP maps onto the old model is exactly what the Rapid Spanning Tree guide focuses on.
At the access edge you protect and speed up host ports. PortFast moves an access port straight to forwarding so a PC or server never waits through listening and learning, and BPDU Guard err-disables that PortFast port the instant it receives a BPDU — stopping a rogue switch or a wiring loop from hijacking your topology. Related features such as Root Guard (keeps a port from ever becoming root) and BPDU Filter round out the edge toolkit and appear together on the cheat sheet.
To master the topic, work it in that order: understand why loops happen and how root election, port roles, states, cost, and priority fit together; keep the Spanning Tree cheat sheet open for the exact show and configuration commands (spanning-tree mode, root primary, cost, portfast, bpduguard); then build and grade the labs so you can prove a design converges correctly and the edge stays protected. The concepts here pair directly with the FHRP and VLAN topics, since redundant Layer 2 designs are what STP exists to make safe.
Step-by-step guides
Follow these to configure it yourself, command by command.
Command cheat sheet
Practice on real Cisco IOS
Build and grade hands-on Cisco Modeling Labs — the only way it sticks.
Frequently asked questions
What is the difference between STP and RSTP, and which does Cisco use by default?
Classic STP (802.1D) and Rapid STP (802.1w) run the same root-election and path-selection logic, but they differ in speed. Legacy STP steps a port through blocking, listening, learning, and forwarding using the forward-delay and max-age timers, so it typically takes 30 to 50 seconds to converge after a change. RSTP reduces the states to discarding, learning, and forwarding, adds alternate and backup port roles, and uses a proposal/agreement handshake to converge in about a second on point-to-point links. On Cisco Catalyst switches, spanning tree runs per VLAN; depending on the platform and IOS version the default may be PVST+ or Rapid PVST+, and you can force the rapid variant with 'spanning-tree mode rapid-pvst'.
How is the STP root bridge elected, and how do I control which switch wins?
Every switch advertises its Bridge ID, which is the bridge priority followed by the switch's MAC address. The switch with the lowest Bridge ID becomes the root bridge; since the default priority is 32768 on every switch, the election falls through to the lowest MAC address, which is essentially random and usually not the switch you want. To control it, lower the priority (only in increments of 4096) on your chosen switch, or use 'spanning-tree vlan <id> root primary', which sets a low priority for you. Because Cisco runs one instance per VLAN, you can pick a different root per VLAN to balance traffic.
In what order should I learn STP, and how much of the CCNA does it cover?
Learn it conceptually first: why Layer 2 loops are catastrophic, then root election, then port roles and states, then cost and priority tuning, and finally edge features like PortFast and BPDU Guard. After the concepts, use the cheat sheet to lock in the commands and build the labs to verify convergence hands-on. Spanning tree sits inside the Layer 2 switching portion of the CCNA blueprint and is reliably tested, but Cisco periodically adjusts exam-topic weightings, so treat any specific percentage as approximate and confirm against the current official exam topics.
Study every CCNA topic this way
The CCNA Complete Path sequences all 17 lab bundles into one graded progression you own forever.