Network Bytes · Episode 32 · CCNA 2.5
"Spanning Tree: why loops kill networks"
A backup link between switches creates a loop, and a single broadcast can circle it forever until the network freezes. Spanning Tree Protocol blocks redundant ports so the loop can't form, and unblocks them if the main path fails.
A backup link makes a loop
Engineers like redundancy: if one cable between two switches breaks, a second path keeps traffic flowing. But connect three switches to each other and you've drawn a circle, a switching loop. Traffic can now leave a switch and come back to it from the other side.
One broadcast, endless copies
Switches flood broadcast frames (and frames for unknown destinations) out of every port except the one they came in on. In a loop, that means each switch sends a copy both ways around the circle, the next switch floods it again, and the copies keep coming back. Switches also see the same source MAC address arriving on different ports, so their MAC address tables keep flipping.
Why the frames never die
An IP packet has a TTL (time to live) field that routers count down, so a packet stuck in a routing loop eventually gets dropped. The Ethernet header has no such field, and switches don't check the IP TTL. A looping frame never expires. Within seconds the copies pile up into a broadcast storm that eats all the bandwidth and the CPU of every device that has to process them, and the network freezes.
The fix: Spanning Tree Protocol
STP (originally IEEE 802.1D, now folded into IEEE 802.1Q) lets the switches talk to each other, map the links, and agree on a loop-free tree. Ports that would complete a loop go into a blocking state: they stay physically connected but don't forward user traffic. If an active link fails, STP recalculates and a blocked port moves to forwarding, so the backup takes over.
Strictly, STP blocks ports, not whole cables. Classic STP can take around 30 to 50 seconds to bring a backup path up; Rapid STP (802.1w) and Cisco's Rapid PVST+, the default on newer Catalyst switches, converge much faster.
Try it yourself
In the free Cisco Packet Tracer, connect two switches with a single cable and run show spanning-tree on each: every port is FWD (forwarding). Now add a second cable between the same two switches, wait a moment, and run it again. A port's link light turns amber and show spanning-tree lists it as BLK: STP spotted the loop. Unplug the first cable and watch the amber port go green.
Good to know
- The Ethernet header has no TTL field, and switches don't check the IP TTL, so looping broadcast and unknown-unicast frames circulate until the loop is broken.
- Loops also make MAC address tables flap, as the same source address shows up on different ports.
- STP (IEEE 802.1D, now part of 802.1Q) blocks ports, not whole cables.
- Classic STP takes up to about 30-50 seconds to unblock a backup path; Rapid STP (802.1w) and Cisco's default Rapid PVST+ on newer switches are much faster.
For CCNA learners
This lines up with CCNA 200-301 exam topic 2.5, interpret basic operations of Rapid PVST+ Spanning Tree Protocol: know why Layer 2 loops are dangerous and that STP blocks redundant ports to prevent them.
Answer to the comment question
One. A triangle of three switches has three links but only one loop. Blocking one port on one of the links breaks that loop, and every switch can still reach the others through the two links that keep forwarding. Block more and you'd lose the redundancy for nothing. (In general, a loop-free tree connecting N switches needs N - 1 forwarding links.)
Test your knowledge
Quick quiz: "Spanning Tree: why loops kill networks"
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- Cisco, "Configuring Spanning Tree Protocol" (Catalyst 9200, IOS XE 17.17): STP prevents loops while allowing redundant paths, blocks redundant ports and unblocks a backup if the active path fails; Rapid PVST+ is the default mode
- Cisco, "Configuring STP" (Catalyst 2960, 15.2(1)E): loops cause duplicate frames; port states including blocking; default timers
- IEEE SA, "IEEE 802.1D MAC Bridges": the original spanning tree standard, now superseded by and folded into 802.1Q
- Cisco, CCNA 200-301 v1.1 exam topics: 2.5 interpret basic operations of Rapid PVST+ Spanning Tree Protocol
Video transcript
How can one extra cable take down a whole office?
Engineers connect switches with a second link, as a backup in case the first one breaks. Smart, right? But now the switches form a loop, a circle traffic can run around.
A broadcast enters the loop. Each switch floods it out every other port, so copies race around the circle in both directions, over and over.
Ethernet frames have no expiry timer, so they never die. Within seconds, this broadcast storm eats all the bandwidth, and the whole network freezes.
The fix is Spanning Tree Protocol. The switches map the links and put one in a blocking state. If the main link fails, the backup wakes up.
Three switches in a triangle. How many links does Spanning Tree block to break the loop? Comment your answer below!
That's your byte.