When I first opened the 5.Also, one extra cable between two switches, and the simulation lit up with blinking lights, frantic MAC address tables, and a CPU usage graph that spiked to the red zone. 1 9 packet tracer investigate stp loop prevention lab, I was surprised at how quickly a simple miswired link could bring a whole network to its knees. It’s a vivid reminder that layer‑2 loops aren’t just theoretical — they can halt traffic in seconds if spanning‑tree isn’t doing its job That's the part that actually makes a difference..
Counterintuitive, but true.
What Is 5.1 9 Packet Tracer Investigate STP Loop Prevention?
This lab is part of the Cisco CCNA curriculum, specifically the section that walks you through observing how the Spanning Tree Protocol (STP) stops loops from forming. In Packet Tracer you build a small topology, deliberately create a redundant link, and then watch STP put one of the ports into a blocking state so traffic can’t circle forever.
The purpose of the lab
The goal isn’t just to memorize STP states; it’s to see the protocol in action. You get to enable STP, view BPDUs, change port costs, and verify that the network converges without a broadcast storm. By the end you should be able to explain why a particular port is blocking, forwarding, or listening, and how a change in topology triggers a recalculation Simple as that..
What you’ll see in Packet Tracer
You’ll start with three switches arranged in a triangle. Each switch has two connections to its neighbors, giving you two possible paths between any pair of devices. Initially STP is disabled, so you can ping end‑devices and see the traffic flow freely. Then you enable STP, introduce the loop, and use the simulation mode to watch BPDUs travel. Finally you check the spanning‑tree database with show spanning‑tree commands to confirm which port is blocked and why Still holds up..
Why STP Loop Prevention Matters
Loops at layer‑2 are more than a nuisance; they can cripple an entire campus network in a matter of seconds. Worth adding: when a switch receives a frame whose destination MAC isn’t in its table, it floods the frame out all ports except the one it arrived on. If there’s a loop, that frame keeps getting flooded back and forth, multiplying with each pass. The result is a broadcast storm that overwhelms CPU, fills buffers, and drops legitimate traffic.
Real-world impact of loops
I’ve seen a small office network go down because a technician accidentally patched a spare cable between two access switches. Which means sTP was either misconfigured or turned off on those switches. On top of that, the root cause? Within minutes, users couldn’t reach the file server, VoIP calls dropped, and the switches’ LEDs were flashing like a strobe light. Once we re‑enabled it and verified the blocked port, the storm collapsed and normal service resumed.
Why engineers use STP
STP provides a deterministic way to keep a loop‑free logical topology while still retaining physical redundancy. If a link fails, STP can unblock a previously blocked port and restore connectivity without manual intervention. It’s the safety net that lets designers build resilient networks without constantly worrying about accidental loops Simple, but easy to overlook. And it works..
Quick note before moving on Small thing, real impact..
How the Lab Works: Step‑by‑Step Guide
Below is a walkthrough that mirrors what you’ll do in Packet Tracer. Feel free to follow along in your own copy of the lab; the commands and observations are the same whether you’re using the latest version or an older release Surprisingly effective..
Setting up the topology
- Drag three Cisco 2960 switches onto the workspace and label them S1, S2, and S3.
- Connect S1’s FastEthernet0/1 to S2’s FastEthernet0/1, S2’s FastEthernet0/2 to S3’s FastEthernet0/1, and S3’s FastEthernet0/2 back to S1’s FastEthernet0/2. You now have a triangular loop.
- Add two PCs, attach one to S1 and the other to S3 via their FastEthernet ports, and give them IP addresses in the same subnet (e.g., 192.168.1.10/24 and 192.168.1.20/24).
- At this point, leave STP disabled on all
switches so you can observe the default flooding behavior. On each switch, enter global configuration mode and issue spanning-tree mode pvst (the default on 2960s) followed by no spanning-tree vlan 1 to administratively disable the protocol for VLAN 1.
Verifying connectivity before STP
With the loop active and STP turned off, open a command prompt on PC1 and ping PC2 (ping 192.Because of that, 20). 168.That said, 1. Send a single ping and watch the animation: the ARP request from PC1 floods out every port on S1, traverses both paths to S3, and arrives at PC2 twice. The replies succeed, but switch to Simulation Mode in Packet Tracer and filter for ICMP and ARP. Here's the thing — pC2 replies, and those replies loop endlessly between the switches until the simulation buffer fills or you stop the capture. This visual confirmation proves that a Layer 2 loop creates duplicate frames and uncontrolled flooding—the exact scenario STP is designed to eliminate.
Enabling STP and watching convergence
Return to Realtime Mode. On all three switches, re-enable STP for VLAN 1 with spanning-tree vlan 1. Plus, the switches immediately begin exchanging BPDUs. Even so, switch back to Simulation Mode, clear the event list, and filter for BPDU and STP. Step through the simulation one event at a time.
You will see the following sequence:
- Root Bridge Election: All switches initially claim to be the root (Bridge ID = Priority 32768 + MAC). Because S1 has the lowest MAC address in this lab, its BPDUs are superior. Consider this: s2 and S3 receive S1’s BPDUs on their directly connected ports and transition those ports to the Root Port role. 2. Designated Port Selection: On the link between S2 and S3, both switches advertise a Root Path Cost of 19 (default cost for FastEthernet). The tie is broken by the lower Bridge ID (S2). That's why, S2’s Fa0/2 becomes the Designated Port (Forwarding), while S3’s Fa0/1 transitions to Alternate/Blocking state. So 3. Here's the thing — Port State Progression: Watch the blocked port on S3 move through the standard STP timers: Blocking → Listening (15 sec) → Learning (15 sec) → Blocking (stabilized). Because this is PVST+, the port never reaches Forwarding; it settles into Blocking to break the loop.
Analyzing the spanning-tree database
Exit Simulation Mode and return to the CLI. The definitive proof of the loop-free topology lives in the show spanning-tree output. Run the following commands on each switch to build a complete picture That's the part that actually makes a difference..
On S1 (Root Bridge):
S1# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.2e00 (S1's MAC)
Cost 0
Port 0 (Root)
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0001.That's why 64a8. 64a8.
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.But 2 P2p
Observation: S1 is the Root Bridge. Practically speaking, both its ports are Designated Forwarding. It sends BPDUs down both links.
On S2 (Non-Root, Directly Connected to Root):
S2# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.64a8.2e00
Cost 19
Port 1 (Fa0/1)
Bridge ID Priority 32769
Address 0002.11aa.
Interface Role Sts Cost Prio.Even so, nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Root FWD 19 128. 1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
Observation: S2’s Root Port is Fa0/1 (lowest cost to Root) But it adds up..
Observation: S2’s Root Port is Fa0/1 (lowest cost to Root). Its link to S3 (Fa0/2) to S3Designated Forwarding, Fa0/2, is also in the Designated Forwarding state, confirming that S2 is acting as the designated switch on that segment.
On S3 (Non‑Root, Indirectly Connected to Root):
S3# show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.64a8.2e00
Cost 38
Port 2 (Fa0/2)
Bridge ID Priority 32769
Address 0003.55cc.
Interface Role Sts Cost Prio.Because of that, nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Altn BLK 19 128. In real terms, 1 P2p
Fa0/2 Root FWD 19 128. 2 P2p
Observation: S3’s Root Port is Fa0/2, which points toward S2 (and ultimately to the root S1) with a cumulative root‑path cost of 38 (19 + 19). Because of that, the opposite interface, Fa0/1, is shown as Alternate/Blocking (Altn BLK), meaning it is receiving superior BPDUs from S2 but is kept in a blocking state to prevent a loop. The port has progressed through the STP timers (Blocking → Listening → Learning → Blocking) and now remains stable in the Blocking role And that's really what it comes down to..
Verifying the Loop‑Free Topology
Collecting the three show spanning-tree outputs gives a clear, end‑to‑end view:
| Switch | Port | Role | State | Cost to Root |
|---|---|---|---|---|
| S1 (Root) | Fa0/1 | Designated | FWD | 0 |
| S1 (Root) | Fa0/2 | Designated | FWD | 0 |
| S2 | Fa0/1 | Root | FWD | 19 |
| S2 | Fa0/2 | Designated | FWD | 19 |
| S3 | Fa0/1 | Alternate | BLK | 19 (received) |
| S3 | Fa0/2 | Root | FWD | 38 (19 + 19) |
All active ports (those in the Forwarding state) form a tree rooted at S1 with no redundant paths. The only blocked link is S3‑Fa0/1, which sits on the segment between S2 and S3 and effectively breaks the potential loop.
Why PVST+ Behaves This Way
Per‑VLAN Spanning Tree Plus (PVST+) runs an independent STP instance for each VLAN. In this lab only VLAN 1 is configured, so the output reflects a single spanning‑tree instance. The election process follows the classic IEEE 802 Practical, not theoretical..
- Root Bridge – lowest Bridge ID (priority + MAC). S1 wins.
- Root Port – each non‑root switch selects the port with the lowest root‑path cost.
- Designated Port – on each LAN segment, the switch advertising the lowest root‑path cost (and, if tied, the lowest Bridge ID) becomes designated.
- Port States – blocked ports transition through Listening and Learning before settling in Blocking (or, in rare cases, Forwarding if the topology changes).
Because the link costs are identical (19 for each FastEthernet link), tie‑breakers fall to Bridge IDs, which is why S2’s Fa0/2 becomes designated and S3’s Fa0/1 ends up blocked.
Conclusion
The show spanning-tree output confirms that the network has converged to a loop‑free topology: S1 is
the root bridge, and all active paths converge correctly toward it. Also, s2 forwards traffic toward the root via its root port (Fa0/1) while maintaining its own designated port (Fa0/2) to serve the segment connected to S3. Meanwhile, S3’s alternate port (Fa0/1) remains blocked, ensuring that the redundant link between S2 and S3 does not create a forwarding loop. This configuration exemplifies how STP dynamically elects roles and states to maintain a stable, loop-free Layer 2 topology. Even so, the consistent port costs (19 for FastEthernet) and Bridge ID tie-breaking logic further validate the deterministic behavior of PVST+ in a single-VLAN environment. By systematically disabling redundant paths until they are needed, STP ensures predictable traffic flow and network resilience, making it a cornerstone of scalable Ethernet switching architectures.