Spanning Tree Without Tears: What It Does and How It Fails
Spanning tree has a reputation problem. It works silently in the background of nearly every switched network, preventing catastrophes daily and never once asking for credit. And then, on the rare day something goes wrong, it is suddenly the villain in the incident report. Admins learn to fear it the way sailors fear weather: powerful, invisible, and apparently moody. Much of that fear is really unfamiliarity. The protocol's actual logic fits on an index card.
Here is the card: spanning tree finds redundant paths between switches and blocks them on purpose, keeping one loop-free set of paths active and holding the spares in reserve. Everything else — elections, port roles, topology changes — is machinery in service of that one sentence. If you read Anatomy of a Network Loop, you know why the blocking is not optional. Ethernet frames never expire, so any circle of active links turns background chatter into a self-sustaining broadcast storm. Redundant cabling is good. Redundant active cabling is a bomb. Spanning tree is the mechanism that lets you have the first without the second.
This guide explains the machine in plain language. It covers what gets blocked and why, who decides, and what a topology change actually is. It then walks through the three classic ways the machine fails, because the failures teach more than the theory. We stay deliberately generic: spanning tree exists in several variants with different speeds and per-VLAN behaviors. But the logic below is common to all of them, and so are the failure modes.
In this guide
- The job: blocking redundant paths on purpose
- BPDUs: how switches compare notes
- The root bridge election, and why the winner matters
- Port roles, kept simple
- Topology changes: the tree reshaping itself
- Failure 1: the desk switch that won the election
- Failure 2: the link that only works one way
- Failure 3: mixed vendors, mixed assumptions
- Topology-change counts as a health signal
The job: blocking redundant paths on purpose
Start with the tension the protocol resolves. You want redundant links between switches, because cables get crushed and transceivers die. A network with one path per destination goes dark every time either happens. But two active paths between the same two points form a loop, and a loop is a meltdown. The resolution: build the redundant physical topology, then let a protocol keep just enough of it switched off.
Think of fire doors in an office building. The architects deliberately built extra corridors, but some doors are held closed in normal operation so that people flow along one predictable route. When the main corridor is blocked, a held door releases and the spare route opens. Nobody calls the closed door "wasted corridor" — it is standby capacity with an automatic release. A spanning-tree blocked port is exactly that: cabled, powered, listening, and deliberately not forwarding until it is needed.
The name describes the goal. From all the physical links available, the protocol computes a tree — a set of paths with no circles — that spans every switch. That means everyone can still reach everyone. Links in the tree forward traffic; surplus links are blocked. Lose a link in the tree, and the protocol recomputes, promoting a blocked link into service. Your job as an admin is mostly to let it do this — and to make sure nothing fools it. That is what the failure half of this guide is about.
BPDUs: how switches compare notes
Switches build the tree by talking to each other with small status messages called BPDUs (bridge protocol data units). "Bridge" is the older word for what we now call a switch. Every switch port that participates sends them regularly, typically every couple of seconds, and listens for its neighbors' BPDUs in return. A BPDU is a switch's business card plus a boast: this is who I am. This is who I currently believe the root of the tree is. And this is how far I am from that root.
That is the entire communication model. There is no central controller and no map. Each switch just compares the claims arriving on each port with its own information, keeps the best claims, and passes them on. Out of thousands of these little comparisons, one consistent tree emerges. In the same way, a crowd can agree on the shortest way out of a building by everyone repeating the best directions they have heard so far. Two properties of this model matter enormously later. First, BPDUs arrive continuously: a switch expects to keep hearing from its neighbors, and treats sustained silence as "the neighbor is gone." Second, any device that speaks BPDU gets a vote. Both properties are load-bearing, and both can be exploited by accident — hold that thought for the failure stories.
The root bridge election, and why the winner matters
Before anyone can compute "the best loop-free paths," the network needs a shared reference point. That is because "best path" only means something when you agree what you are measuring toward. Spanning tree solves this by electing one switch as the root bridge — the anchor of the tree. Every other switch then answers a single question: what is my cheapest way toward the root? Keep those paths, block the surplus, done.
The analogy that makes this stick: the root is the town fountain everyone gives directions from. Once the whole town agrees to describe every location by its route to the fountain, all directions become consistent and no route ever circles. But notice what the choice of fountain does: it shapes every route in town. Pick a fountain in the town square and directions are short and sensible. Pick one in a shed on the outskirts, and every journey detours past the shed. Same town, same roads — the reference point rearranged all the traffic.
The election itself is almost embarrassingly simple. Every switch has a bridge ID: a configurable priority number, with its MAC address as the tie-breaker. Lowest wins. Switches exchange BPDUs, each initially nominating itself, and within seconds everyone has seen the lowest ID and agreed on the winner. Here is the part to tattoo somewhere visible: if you never set priorities, every switch has the same default, so the tie-breaker decides — and the lowest MAC address wins. MAC addresses are assigned at manufacture, and lower ones tend to live in older hardware. In other words, by default your network's most important structural role is awarded to whichever box has the most venerable network card. That is not a hypothetical; it is the setup for the first failure story below. The fix costs one command per switch. Deliberately set a low priority on the switch you want as root (your core). Set a slightly higher one on the backup. And leave everything else at default.
Port roles, kept simple
Once a root exists, every port on every switch settles into a role. The vocabulary varies slightly between variants, but three roles carry the idea:
| Role | Plain meaning | How many |
|---|---|---|
| Root port | "My best way toward the root" — the port this switch uses upstream | One per switch (except the root itself, which has none) |
| Designated port | "I am the official forwarder for this link" — the end of each link that speaks for it | One per link; on the root bridge, every port |
| Blocked / alternate port | "The fire door" — a surplus path, silenced on purpose, held ready as the spare | Whatever is left over |
Who gets which role is decided by the same measuring-toward-the-root logic as everything else. On each link between two switches, the end with the cheaper path to the root becomes the designated port and forwards. If the other end has a better route of its own elsewhere, its side of the link goes to standby. Ties are settled by comparing bridge IDs, so the outcome is always deterministic. The same physical network with the same settings computes the same tree every time. When the tree surprises you, something in the inputs changed: a cost, a priority, or who is root.
A blocked port is not a dead port. It stays up, it listens to BPDUs, and it counts the seconds since it last heard from the neighbor it is protecting against. It simply refuses to forward user traffic. This is worth explaining to colleagues before they discover a blocked port on their own. That is because to the uninitiated it looks exactly like a fault: a perfectly good cable, link lights on, carrying nothing. More than one loop incident has started with someone "fixing" a blocked port by moving the cable somewhere it would forward. The port was not broken; it was on guard duty.
Topology changes: the tree reshaping itself
When a link in the active tree dies, the machinery reacts. The switch that lost its path stops hearing BPDUs or sees the link drop. Nearby switches compare notes again. And somewhere a blocked port is promoted to forwarding. The network has a new tree. This event is a topology change. Depending on the variant and the situation it costs anywhere from moments to tens of seconds of disruption while the paths settle. That is one honest reason modern networks prefer the faster variants.
Topology changes have a side effect worth knowing. Switches deliver traffic using their MAC address tables. These are learned mappings of "this address lives out this port". A reshaped tree makes some of those mappings wrong. So a topology change tells switches to age out or flush learned entries quickly. Until relearning finishes, traffic to forgotten addresses is flooded everywhere, the way unknown destinations always are. A burst of flooding and a brief performance dip right after a change is therefore normal. But it also means topology changes are never free. And a network having them constantly is a network constantly mildly storming. That is exactly why the change counter makes such a good health signal, as we will see at the end.
One refinement keeps that signal clean. A PC being switched on should not count as the network changing shape — and it does not have to. Ports facing end devices can be marked as edge ports (vendors use various names for the setting). That tells the switch that nothing on this port participates in the tree, so its comings and goings are nobody's business. Properly marked edges skip the slow role negotiation when a device connects and stay out of the topology-change bookkeeping. On a network where every user port is an edge port, the change counter moves only when infrastructure actually changes. That is precisely what makes it worth alarming on.
Failure 1: the desk switch that won the election
Now the classics. Failure one is pure default settings. A department buys a small managed switch for a corner of the office. Someone plugs it in. It speaks spanning tree, as managed switches do out of the box. Its priority is the same default as everyone else's — and its MAC address happens to be lower than your core switch's. The election is rerun the moment its first BPDU arrives, and the plastic newcomer wins. Every switch in the building now measures its best path toward a desk in accounting.
Nothing crashes. That is what makes this failure so sneaky. The network re-converges obediently around the new root. Uplinks that used to forward go blocked. Traffic between wiring closets detours through the desk switch's modest little ports. And the whole building's east-west traffic tries to fit through hardware built for one printer and a coffee-break laptop. Users report slowness in odd patterns; graphs show respectable links mysteriously idle while one small port runs hot. The giveaway is checking who is root and getting a wrong answer. That is why "verify the root is the switch we chose" belongs in your monitoring, not just in your memory. The fix is the priority setting described above. The guard rail that prevents the rerun entirely (root guard, plus keeping switch-speak off user ports) lives in Designing Loops Out.
Failure 2: the link that only works one way
Failure two exploits the protocol's trust in silence. Remember: a blocked port stays blocked because it keeps hearing BPDUs from the neighbor across the link. The assumption underneath is that a working link works in both directions. That is usually true. But fiber links have separate strands for each direction. A damaged strand, a failing transceiver, or a bad patch can create a unidirectional link. In that link, traffic flows one way and dies the other.
Walk through what the blocked port experiences. Its own transmit strand is fine; the neighbor's transmit strand toward it is dead. BPDUs stop arriving. From the port's point of view, the neighbor has vanished. So after the customary patience expires, the blocked port does exactly what the protocol says: promotes itself and starts forwarding. But the link still carries traffic the other way — so there is now a one-way circle. Frames flow around it, storms ignite, and the cruel joke is that spanning tree is functioning precisely as designed. It was told, by silence, that the redundant path was gone. Silence lied. This is why switch vendors offer unidirectional-link detection features under various names. These mechanisms verify a neighbor can hear you before trusting a link. That false silence is also why unexplained "STP did something insane" stories deserve a hard look at the optics and patch cords before anyone blames the protocol.
Failure 3: mixed vendors, mixed assumptions
Failure three is quieter: a network assembled from different vendors' gear, each running its factory-default flavor of spanning tree. The core logic is standardized, but the defaults around it are not. Vendors differ on whether the tree is computed once for the whole switch or separately per VLAN. They also differ on default priorities and timers, on how edge ports behave, and on which enhancements are enabled out of the box. Plug the pieces together and each box does something locally reasonable. But the network-wide result can be a tree that does not line up. One VLAN may be blocked where you expected forwarding. Another VLAN may have no blocking where you needed it. And convergence behavior may change depending on which side of the room failed.
The insidious version is the network that seems fine because the defaults happen to interoperate in the current topology. Then an unrelated change (a new VLAN, a replaced core, a firmware update) shifts an assumption, and a loop appears in a network nobody touched "in that area." The defense is boring and effective: decide your spanning-tree design on purpose. Pick one variant your gear shares, set the root and backup-root priorities explicitly, confirm per-VLAN behavior end to end, and write it down. An accurate diagram of what should be blocked where, per Network Diagrams That People Actually Use, turns "is this tree right?" into a thirty-second visual check.
Tip: after any switch install or replacement, run the vendor's spanning-tree status command and answer three questions before you leave: Who is root? Is that who we chose? Are the blocked ports where the design says they should be? Ninety seconds of ritual, and two of the three failures above become impossible to miss.
Topology-change counts as a health signal
Every switch will show you its view of the tree, and the output is less scary than its reputation. On many platforms it looks broadly like this:
switch# show spanning-tree vlan 20
Root ID priority 4096
address 00:1a:2b:3c:4d:5e
this switch reaches root via port: uplink-1
Bridge ID priority 32768
address 00:5e:4d:3c:2b:1a
Topology changes: 3
Time since last change: 41 days, 07:12:33
Three lines carry the health story. The root address should match the switch you deliberately chose — if it does not, you are living failure one right now. The topology change count and time since last change tell you how calm the tree is. A small count and a long quiet time is the signature of a healthy network. A count that climbs steadily — or a "time since last change" that never grows old — means something is flapping or someone keeps joining and leaving the tree. Because these values are exposed over SNMP alongside everything else you poll, they belong in your monitoring baseline. The guide Early-Warning Signs of Loops and Storms ranks the change counter among the five signals worth alerting on, and shows the thresholds to start from. A quietly aging tree is one of the most reassuring numbers a network can produce. Learn what yours looks like on a boring Tuesday, and Thursday's weirdness will introduce itself.
Where to go next
The index card again: spanning tree elects a reference switch, keeps everyone's best path toward it, and blocks the surplus — fire doors held shut until needed. It fails when defaults pick a silly root, when a one-way link feeds it lying silence, or when mixed defaults quietly disagree. All three are visible in output you can check in seconds and counters you can monitor continuously. From here, Designing Loops Out covers the guard features that keep the tree honest at the edges. And the rest of Loops, Broadcast Storms & Spanning Tree handles the day something slips through anyway — including the storm response playbook you hopefully never need.
Put this into practice with SysPeep Monitor
Who is root, whether the tree is calm, and whether a switch CPU just spiked are all questions your monitoring can answer continuously. The data is ordinary SNMP. SysPeep Monitor auto-discovers your switches, polls their health and interface counters, and alerts when numbers that should be boring start moving. The free trial runs on any Windows machine.
Download Free TrialLearn About SysPeep