SW1, SW2, and SW3 are already cabled SW1–SW2 and SW2–SW3, converged and forwarding. An engineer adds a third cable, SW3–SW1, for resilience — this closes a physical triangle. Without any loop-prevention mechanism, this would let a single frame (e.g. a broadcast) circulate the triangle endlessly, being duplicated at every hop — a broadcast storm. STP exists specifically to make sure that never happens.
SetupThe instant SW3–SW1 comes up, both ends send BPDUs (Bridge Protocol Data Units) out that port, each announcing what it currently believes about the network: who the Root Bridge is, and the sender's own Bridge ID (priority + MAC address).
BPDUEvery switch compares every Bridge ID it has ever heard, on every port. The single lowest Bridge ID network-wide wins outright — say SW1 was pre-configured with priority 4096 (lower than the default 32768), so SW1 becomes the Root Bridge. This isn't negotiated per-link; it's a single network-wide outcome every switch converges on independently using the same comparison.
Root ElectionSW2 and SW3 each calculate their cumulative Root Path Cost to SW1 via every port they have, and designate the cheapest one as their Root Port — the single port each non-root switch uses to talk upstream. SW3 has two paths to root: directly via the new SW3–SW1 link, or indirectly via SW3–SW2–SW1. Assume the direct link wins on cost — SW3's Root Port becomes the direct SW1 link.
Root PortFor every link (segment) in the topology, exactly one end is elected the Designated Port — the port responsible for forwarding onto that segment. Root Bridge ports are always Designated by definition. On the SW2–SW3 segment, whichever side is closer to root wins that role.
Designated PortEvery port in the triangle now has exactly one role: Root Port, Designated Port, or — on precisely one port, wherever the topology has a redundant path left over — Blocking. The cable is still fully connected end to end; the switch simply never forwards a data frame out that one port. The wiring is a loop. The path traffic actually uses is a tree. That single sentence is the entire point of Spanning Tree.
CheckpointOn SW2's port toward SW3 (or wherever the redundant path lands, depending on costs), the port loses the Designated-Port election because SW3 already reaches root more cheaply direct via SW1. That port becomes Blocking: it still receives and evaluates BPDUs to keep monitoring the topology, but it forwards zero data frames and learns zero MACs — permanently, as long as the topology doesn't change.
BlockingEvery switch keeps sending Hello BPDUs (every 2 seconds by default) out every port, including the blocked one. This isn't a one-time calculation — it's a live, continuously-verified agreement. If nothing changes, nothing changes: the blocked port simply keeps blocking, forever.
SteadySW2 stops receiving BPDUs on its former Root Port. On classic 802.1D it waits up to Max Age (20s) before acting; Rapid PVST+ reacts to the link-down almost immediately. Either way, SW2 recalculates: its only remaining path to root is via SW3.
FailureThe port that was sitting in Blocking transitions toward Forwarding — through Listening/Learning again on classic STP, or via a fast proposal/agreement handshake on Rapid PVST+ — and becomes the new active path. Connectivity is restored automatically, without anyone touching a cable. This is the entire reason the redundant link was installed in the first place.
Reconvergespanning-tree vlan <id> root primary on Cisco, which sets it low enough to win, with a secondary root configured on another switch as backup. Leaving this to default priority means whichever switch happens to have the lowest MAC wins, which is rarely the switch you'd actually want at the center of the tree.| Term | Meaning |
|---|---|
| Bridge ID | Priority (default 32768) + MAC address — the value compared network-wide to elect the root bridge |
| Root Bridge | The single switch with the lowest Bridge ID; the reference point every path-cost calculation is relative to |
| Root Port | The one port per non-root switch with the lowest-cost path to the root bridge |
| Designated Port | The one port per network segment responsible for forwarding traffic onto that segment |
| Blocking Port | The remaining port on a redundant path — receives/sends BPDUs but forwards no data frames |
| Root Path Cost | The cumulative cost of all links from a switch back to the root bridge, used to choose the Root Port |
| Hello Timer | How often BPDUs are sent to continuously verify the topology — 2 seconds by default |
| Max Age | How long a switch waits without hearing BPDUs before assuming a path has failed — 20s on classic 802.1D |
| Root Guard | A port feature that refuses to let a downstream switch become root, protecting the intended topology |
| Loop Guard | A port feature that blocks a port rather than letting it default to forwarding if BPDUs simply stop arriving |