Recommended resources
The freely available resources this lesson will direct you to.
Hello! Let's get started with our next lesson.
In our last session, we configured "Router-on-a-Stick," allowing you to route traffic between different VLANs using a single trunk link. As you build more robust and resilient networks with multiple switches and redundant trunk links, you introduce a new and significant risk: Layer 2 loops. While redundancy is crucial for network uptime, a looped Layer 2 topology can bring your entire network to a halt within seconds.
Today, we'll explore the protocol designed specifically to solve this problem. You will learn the purpose of the Spanning Tree Protocol (STP) in preventing these catastrophic loops. We will also examine its modern successor, Rapid Spanning Tree Protocol (RSTP), and understand the key improvements it offers for today's networks.
1. The Need for Redundancy and the Problem of Loops
In any critical network, you want to avoid single points of failure. Connecting switches with redundant links is a common way to build a resilient network. If one link fails, traffic can automatically use the backup path. However, Ethernet frames, unlike IP packets, do not have a "Time to Live" (TTL) mechanism to make them expire. In a looped topology, this leads to major problems.
Let's watch a video that details why physical loops are so destructive in a Layer 2 network.
Free CCNA | Spanning Tree Protocol (Part 1) | Day 20 | CCNA 200-301 Complete Course
This video from Jeremy's IT Lab provides a thorough explanation of the issues caused by Layer 2 loops.
Watch the segment from the beginning. As you watch, focus on understanding two specific, critical problems that loops create: Broadcast Storms: How a single broadcast frame (like an ARP request) can be endlessly duplicated and forwarded, consuming all available bandwidth. MAC Address Flapping: How a switch's MAC address table becomes unstable as it sees the same source MAC address arriving on multiple different ports.
As you saw, a simple redundant design without a loop-prevention mechanism is unusable. The network quickly becomes saturated with looping frames, and switches become confused about where devices are located, leading to a complete network failure.
2. The Solution: Spanning Tree Protocol (STP)
To resolve this, the Spanning Tree Protocol (STP), standardized as IEEE 802.1D, was developed. STP's genius is that it allows you to have physical redundancy while creating a logical, loop-free topology.
It achieves this by having the switches communicate with each other to discover the physical topology. They then collaboratively decide to place certain ports in a blocking state. A blocked port doesn't forward any data frames, effectively "breaking" the loop. However, the port remains in a standby mode, ready to be activated if a primary link fails.

Let's watch a short segment that introduces STP's core function.
Free CCNA | Spanning Tree Protocol (Part 1) | Day 20 | CCNA 200-301 Complete Course
Returning to the video from Jeremy's IT Lab, let's see how STP is introduced as the solution.
Watch the portion from this timestamp. Note how placing just one port in a blocking state prevents the loop, while still keeping the link available as a backup.
To make these decisions, switches running STP exchange special messages called Bridge Protocol Data Units (BPDUs). Through an election process, they select a single Root Bridge (the logical center of the network) and then determine the best path from every switch to that root. All other redundant paths are blocked. We will explore this election process in detail in our next lesson. For now, the key takeaway is that STP creates a single, active, loop-free path through the network at any given time.
3. The Weakness of STP and the Rise of RSTP
While classic STP (802.1D) solves the loop problem, it has a significant drawback: it's slow. When the network topology changes (e.g., a primary link fails), STP can take 30 to 50 seconds to transition a blocked port into a forwarding state. In the early days of networking, this was acceptable. In a modern network supporting real-time applications like voice and video calls, a 30-second outage is disruptive.
To address this, the Rapid Spanning Tree Protocol (RSTP), standardized as IEEE 802.1w, was created. RSTP is an evolution of STP, not a replacement; it is backward-compatible but provides much faster network convergence, typically in under a second.
The following article provides a clear, high-level comparison between STP and RSTP.
Spanning Tree vs Rapid Spanning Tree Explained
This article from Lightyear AI concisely breaks down the core functions of both protocols and their key differences.
Please read the sections: "What is Spanning Tree Protocol (STP)?" "What is Rapid Spanning Tree Protocol (RSTP)?" "Key Differences Between STP and RSTP" (focusing on Convergence Time, Port States and Roles, and Topology Change Notification).
4. Key Improvements in RSTP
As the article highlights, RSTP achieves its speed through several key enhancements over traditional STP. Let's look at the most important ones.
A. Faster Convergence
The most critical improvement is the reduction in convergence time from 30-50 seconds down to milliseconds or a few seconds at most. RSTP doesn't passively wait for timers to expire. Instead, it actively negotiates with neighboring switches and uses pre-determined backup paths to fail over almost instantly.
B. New Port Roles and Simplified Port States
Traditional STP has five port states: Disabled, Blocking, Listening, Learning, and Forwarding. RSTP streamlines this into three: Discarding, Learning, and Forwarding.
More importantly, RSTP introduces new port roles to pre-designate backup paths. While both STP and RSTP have Root Ports (the best path to the Root Bridge) and Designated Ports (forwarding ports on a network segment), RSTP adds two key roles for blocked ports:
- Alternate Port: This port offers a backup path toward the Root Bridge. If the switch's primary Root Port fails, the Alternate Port can immediately transition to a forwarding state.
- Backup Port: This provides a redundant path to a network segment where another port on the same switch is already the Designated Port. This is less common and usually occurs when two ports on a switch are connected to a shared hub.
These new roles are a major reason for RSTP's speed. The switch already knows its best backup path, so there's no need for a lengthy recalculation process.
This excerpt from "Spanning Tree Protocol Explained" on howtonetwork.com provides more detail on RSTP's new port roles and states.
Read the short sections on "RSTP Port Roles" and "RSTP Port States". Pay attention to the definitions of the Alternate Port and Backup Port roles. Also, note the table comparing STP states to RSTP states, which clearly shows the consolidation into the Discarding state.
C. Proactive Link Failure Detection
STP waits for a timer (the Max Age timer, typically 20 seconds) to expire before it assumes a link has failed. RSTP is more proactive. Switches send frequent "hello" BPDUs to each other (every 2 seconds by default). If a switch misses three consecutive hellos from a neighbor, it immediately assumes the link is down and initiates a failover.

Conclusion
You now have a solid understanding of why a loop-prevention mechanism is absolutely essential in any switched network that uses redundant links. You've seen how STP solves this problem by creating a logical tree, and more importantly, how RSTP dramatically improves on the original standard to meet the demands of modern, high-availability networks.
Key Takeaways:
- The Problem: Redundant Layer 2 links create loops, which cause broadcast storms and MAC address table instability, bringing down the network.
- The Solution (STP): Spanning Tree Protocol (IEEE 802.1D) prevents loops by logically blocking redundant ports, creating a single, active path.
- STP's Limitation: Classic STP is slow to react to network changes, taking 30-50 seconds to converge, which is unacceptable for many modern applications.
- The Improvement (RSTP): Rapid Spanning Tree Protocol (IEEE 802.1w) is an evolution of STP that converges in under a second. It achieves this speed through new
AlternateandBackupport roles, streamlined port states, and proactive failure detection.
In our next lesson, we will delve into the mechanics of how STP and RSTP actually work. You'll learn about the root bridge election process and the criteria switches use to select their root and designated ports.