Introduction to Spanning-Tree
Introduction
Welcome to Part 25 of the Network Fundamentals study notes! If you haven’t already, we recommend watching the video first.
As networks grow, you connect more switches together. More connections mean more ports, more redundancy — and, if you’re not careful, catastrophic loops. This video explains why those loops are so dangerous and how Spanning-Tree Protocol (STP) prevents them.
The Problem: Layer 2 Loops
As a business grows, it needs more switch ports. The natural solution is to add more switches and connect them together. A small network might start with one switch, then add a second, then a third — and connect all three to each other for redundancy.
This topology looks sensible, but it creates a loop in the network. And loops at layer 2 are a serious problem.
Why Loops Are Dangerous
Recall from Part 11 that when a switch receives a broadcast frame, it forwards it out every other port — including links to other switches. In a looped topology, that broadcast frame gets forwarded around the loop indefinitely. Each switch keeps receiving it and forwarding it again, creating an ever-growing flood of identical frames.
At layer 3, the IP header contains a TTL (Time to Live) field that decrements at each hop and eventually kills the packet. Layer 2 has no equivalent mechanism. Ethernet frames have no built-in loop prevention — once a frame starts looping, nothing stops it.
Broadcast Storms
With even a small number of devices, a single looping broadcast quickly duplicates many times over. Every new broadcast from any device adds more frames to the loop. The result is a broadcast storm — an exponentially growing flood of frames that consumes all available bandwidth and processing capacity on every switch. The network grinds to a complete halt. This can happen within seconds of the loop forming.
Spanning-Tree Protocol
Spanning-Tree Protocol (STP) was developed by Radia Perlman in 1985 to solve exactly this problem. It runs on every switch, automatically detects potential loops in the topology, and strategically disables just enough links to make the network loop-free — while keeping as much connectivity as possible.
You might wonder: why bother cabling those extra links if STP is just going to block them anyway? Two reasons:
- STP is intelligent about which link to block. It typically selects the slowest link in a loop, leaving the faster paths active. This might not be the link you’d intuitively expect.
- Redundancy. If a switch or link fails, STP detects the change and automatically re-enables the previously blocked link, restoring connectivity. Those “redundant” links are your backup.
Key Points to Remember
- STP operates at layer 2
- Layer 2 has no built-in loop prevention
- Layer 3 uses the TTL field in IP headers for loop prevention — but this doesn’t help at layer 2
- Without STP, a single broadcast can bring down an entire network in seconds
- STP typically blocks the slowest link in a loop, keeping faster paths active
In the next part, we’ll look at exactly how STP makes its decisions — how it elects a root bridge, assigns port roles, and handles topology changes.
Resources
Test your knowledge with the Spanning-Tree quiz!
