Lab 9: Spanning Tree — Elect a Root, Block the Loop
CCNA domain: Domain 2 · Network Access (Spanning Tree) · Difficulty: Intermediate · Time: ~40 minutes · Devices: 3 switches (2960), 2 PCs
Three switches wired in a triangle give you two paths between everything — wonderful for surviving a failed link, fatal the moment a broadcast frame starts circling. Ethernet has no TTL, so loops do not fade away; they become storms. Spanning Tree Protocol is the negotiation that keeps the redundancy and kills the loop: the switches elect one root bridge, measure their cheapest path to it, and park exactly the right port in blocking. In this lab you will first switch STP off and meet the storm it prevents, then run the election yourself — and finally rig the re-election so the root lands where you want it.
Your progress on this lab
0 of 6 tasks done — tick tasks off as you finish them; progress is saved in this browser.
What you need
- Cisco Packet Tracer, installed and signed in (free — see how to get Packet Tracer free on the labs hub).
- A brand-new, blank Packet Tracer workspace — do not reuse a previous lab file, the starting state matters.
- Devices: three 2960 switches (SW1, SW2, SW3) and two PCs. This is a pure Layer 2 lab — no router, no gateway.
- Links: copper straight-through everywhere (Packet Tracer's switches auto-sense; on real gear, switch-to-switch links were traditionally crossover cables).
- One flat network: 192.168.1.0/24 on VLAN 1. PC0 is 192.168.1.10 on SW1's Fa0/24; PC1 is 192.168.1.20 on SW3's Fa0/24. Same subnet — leave both gateway fields blank.
Topology
Three switches, three inter-switch links, two PCs. The switch MAC addresses are printed on the diagram because they decide the first election: with every priority left at the default, the lowest MAC in the triangle — SW1's 0001.C911.1111 — is crowned root. The ports are FastEthernet, so every hop costs 19. Notice what is not in the diagram: a blocked port. Which one blocks, and why that one, is the lab.
| Device | Interface | Connects to | Notes |
|---|---|---|---|
| SW1 | Fa0/1 | SW2 Fa0/1 | Bridge ID 32769 / 0001.C911.1111 — lowest MAC in the triangle |
| SW1 | Fa0/2 | SW3 Fa0/1 | |
| SW1 | Fa0/24 | PC0 | Access port |
| SW2 | Fa0/1 | SW1 Fa0/1 | Bridge ID 32769 / 0001.C922.2222 — becomes root in Task 5 |
| SW2 | Fa0/2 | SW3 Fa0/2 | |
| SW3 | Fa0/1 | SW1 Fa0/2 | Bridge ID 32769 / 0001.C933.3333 — highest bridge ID |
| SW3 | Fa0/2 | SW2 Fa0/2 | Hosts the blocking port in the first election |
| SW3 | Fa0/24 | PC1 | Access port |
| PC0 | FastEthernet 0 | 192.168.1.10 /24 | No gateway — same subnet as PC1 |
| PC1 | FastEthernet 0 | 192.168.1.20 /24 | No gateway — same subnet as PC0 |
Tasks
Build the topology first, then work through the tasks in order. Try each task from memory before you open the commands — that is how the skill sticks. Click Show commands only when you are stuck or to check your work.
Task 1 — Close the triangle — then break it on purpose
Build the triangle: SW1–SW2, SW1–SW3 and SW2–SW3, with PC0 on SW1 and PC1 on SW3. Address the PCs (192.168.1.10 and 192.168.1.20, /24 — same subnet, so no gateway exists or is needed). Ping PC0 → PC1: it works, and the triangle looks harmless. It is not. Ethernet frames have no TTL, so a broadcast that gets into a loop never dies — it just multiplies. Normally the switches' built-in STP quietly prevents that. To see what STP saves you from, switch it off on SW3, then open Packet Tracer's Simulation mode, send one ping from PC0, and watch copies of the same frames chase each other around the triangle while the switches' MAC tables flap between ports:
On SW3: no spanning-tree vlan 1 PC0 > Desktop > Command Prompt: ping 192.168.1.20 Then watch in Simulation mode — one broadcast becomes a storm.
Task 2 — Turn STP back on — explicitly
That storm is why Spanning Tree Protocol exists: switches exchange BPDUs, agree on a single reference point (the root bridge), and deliberately block the ports that would complete a loop. On real 2960s STP runs by default as PVST+ (one spanning-tree instance per VLAN, so each VLAN can have its own root and its own blocked port). 'On by default' is no excuse for not knowing it is there — make the mode explicit on all three switches and bring SW3 back into the tree:
On SW1: spanning-tree mode pvst On SW2: spanning-tree mode pvst On SW3: spanning-tree vlan 1 spanning-tree mode pvst
Task 3 — Read the bridge IDs and predict the root
Every switch advertises a bridge ID: its priority (default 32768, changeable only in multiples of 4096) with the VLAN number added by the system ID extension — 32769 for VLAN 1 — followed by its MAC address. The lowest bridge ID wins the root election: priority first, MAC as the tiebreak. Run show spanning-tree on each switch, harvest the three bridge IDs (SW1 ends .1111, SW2 .2222, SW3 .3333), and write down your prediction before you check: with all priorities equal, SW1's lower MAC should have won. Then find 'This bridge is the root' on SW1 and confirm.
On SW1: show spanning-tree On SW2: show spanning-tree On SW3: show spanning-tree
Task 4 — Verify every port role
Now account for all nine triangle ports. Each switch picks a root port — its cheapest path to the root (each FastEthernet hop costs 19). Designated ports forward for their segment; the one port left over blocks. You should find: SW1 (root) all Desg FWD; SW2's Fa0/1 is its Root port, Fa0/2 Designated; SW3's Fa0/1 is its Root port (straight to the root, cost 19) and Fa0/2 sits in BLK — it lost the designated election for the SW2–SW3 segment on bridge ID, so it is the loop-breaker. Exactly one port blocks. That is a healthy tree.
On SW2: show spanning-tree On SW3: show spanning-tree
Task 5 — Move the root to SW2 with a priority change
An election won by an accident of MAC addresses is not a design. Make SW2 — the switch in the middle of your diagram — the root on purpose: drop its VLAN 1 priority to 4096, the lowest standard step. Its bridge ID falls to 4097 and beats every 32769 on the floor. Give the tree up to a minute to reconverge (listening and learning states take 15 seconds each), then re-read the roles: SW1's Fa0/1 becomes a Root port; SW3 now reaches the root fastest through SW2, so its Fa0/2 becomes its Root port and the blocking job moves to SW3's Fa0/1. The blocked port follows the root — always.
On SW2: configure terminal spanning-tree vlan 1 priority 4096 end On SW1: show spanning-tree On SW3: show spanning-tree
Task 6 — Final verification — one path, one blocked port
Close it out. PC0 → PC1 must ping cleanly, travelling PC0 → SW1 → SW2 → SW3 → PC1 through forwarding ports only. Sweep show spanning-tree on SW3 one last time and count the tree's state: root = SW2 (priority 4097), SW3's Fa0/2 Root FWD, Fa0/1 in BLK — still exactly one blocking port in the whole triangle, just standing guard on a different door. Redundancy intact, loop impossible.
On SW3: show spanning-tree PC0 > Desktop > Command Prompt: ping 192.168.1.20
Verification
Run these checks from the switch CLIs (and a PC command prompt where noted). Your output should match the description — wording may vary slightly by Packet Tracer version.
- show spanning-tree on SW1 before Task 5 — the Root ID section reads 'This bridge is the root': priority 32769, address 0001.C911.1111, and all three of SW1's ports are Desg FWD.
- SW3 before Task 5 — Fa0/1 is Root FWD (cost 19, straight to the root) and Fa0/2 is Altn BLK. That single BLK is the whole triangle's insurance policy.
- show spanning-tree on SW2 after Task 5 — Root ID priority drops to 4097 with SW2's own address, and the Bridge ID section agrees: this bridge is the root.
- SW3 after Task 5 — the roles have traded places: Fa0/2 is now Root FWD (cheapest path to SW2) and Fa0/1 is the one in BLK. Still exactly one blocking port.
- PC0 → PC1 ping succeeds at every stage after convergence. (Expect the first ping straight after a change to drop a packet or two while a port walks through listening and learning — 30 seconds of patience is classic STP behavior, and the reason RSTP exists.)
Exam connection
Spanning Tree is core Domain 2 (Network Access) material, and the exam tests the reasoning, not the button-pushing: root election by bridge ID (priority in multiples of 4096, MAC as tiebreak), root / designated / blocking port roles, port cost by speed, and PVST+ running one instance per VLAN. Know why a blocked port still hears BPDUs, why an accidental root bridge hurts, and why RSTP replaced 30–50 second waits with near-instant convergence. If you can predict the tree before you run the command, the exam questions become free marks — warm up with the free 30-question CCNA practice sample and the CCNA 200-301 guidebook.
Turn lab skills into exam marks
Nine labs in — one to go. The capstone lab breaks a network in four places and hands you the wrench. After that, prove the skills with the free practice sample: same topics, exam wording, timed pressure.
Free CCNA SampleCCNA GuidebookFAQ
How does STP choose the root bridge?
By the lowest bridge ID. The bridge ID is the configured priority (default 32768, changeable only in multiples of 4096) plus the switch's MAC address, with the system ID extension adding the VLAN number — so a default VLAN 1 bridge ID reads 32769. If every switch runs the default priority, the oldest switch with the lowest MAC address wins, which is why 'the root is whatever it is' is an accident, not a design. Pin the root deliberately on a strong, central switch and set a secondary as backup.
Why does a port block even though the link is perfectly healthy?
Blocking is the entire point of STP. Between any two switches there can be only one active path, so the port that would complete a loop stops forwarding user traffic. It is not dead, though: it still receives BPDUs, and if the active path fails, STP promotes the blocked port to forwarding automatically — that patience is your free redundancy.
My root bridge is a random access switch in a closet. Does it matter?
Yes. Every frame between other switches hairpins through the root, so a weak or badly placed root adds hops, becomes a traffic bottleneck, and turns its own reboot into a full-network reconvergence. Choose the root on purpose — a core or distribution switch — with spanning-tree vlan 1 priority, and give the intended backup the next value up (8192), so failover lands somewhere sane.