Quick answer: STP prevents loops in redundant switched networks by electing a root bridge, blocking redundant paths, and transitioning ports through blocking, listening, learning, and forwarding states. For the CCNA exam, master root bridge election (lowest bridge ID wins), port roles (root, designated, alternate/backup), and enhancements like RSTP, PortFast, and BPDU Guard. Practice questions below test these exact scenarios.
Why STP Matters for the CCNA Exam
Spanning Tree Protocol (STP) is a foundational Layer 2 protocol that every CCNA candidate must understand cold. Without STP, redundant links in a switched network create broadcast storms, multiple frame copies, and MAC address table instability—all of which can crash a network in seconds. The CCNA exam tests your ability to predict root bridge election, identify port states and roles, and configure STP enhancements like PortFast and BPDU Guard. This guide breaks down exactly what you need, with 10 practice questions to solidify your knowledge.
Root Bridge Election: The First Step
Every STP domain needs a single root bridge—the reference point for all path calculations. The root bridge is elected based on the lowest bridge ID, which combines a 2-byte priority (default 32768) and a 6-byte MAC address. The priority is configurable in increments of 4096.
- Election process: Switches exchange BPDUs (Bridge Protocol Data Units). The switch with the lowest bridge ID becomes root. If priorities tie, the lowest MAC address breaks the tie.
- Key rule: The root bridge is the only switch where all ports are designated (forwarding). All other switches have exactly one root port (the best path to the root).
CCNA exam tip: You’ll often see a scenario with three switches. Manually set one switch’s priority to 0 or 4096 to force it as root. The rest fight over the remaining ports.
Port States and Roles: The Core of STP
STP ports cycle through four states on standard 802.1D: blocking (no data, no learning), listening (listening for BPDUs), learning (building MAC table, no forwarding), and forwarding (normal operation). Ports also have three roles:
| Role | Description | Where it appears |
|---|---|---|
| Root port (RP) | Best path to root bridge | Non-root switches only |
| Designated port (DP) | Best path from a segment to root | One per segment, on the switch closest to root |
| Alternate/Backup port | Blocked redundant path | Non-designated ports |
- Timers: Forward delay (15s for listening, 15s for learning) plus max age (20s) = 30–50 second convergence. This is why STP feels slow.
Common exam question: Given a topology, identify which port is root or designated. Draw the root bridge first, then trace the best path from each non-root switch.
RSTP: Faster Convergence for Modern Networks
Rapid Spanning Tree Protocol (802.1w) replaces the slow timers with a handshake mechanism. Port states shrink to three: discarding, learning, and forwarding. Port roles expand to include alternate (backup to root port) and backup (backup to designated port).
- Edge ports: Similar to PortFast—ports connected to end devices skip listening/learning.
- Proposal/agreement: RSTP negotiates transitions in milliseconds, not seconds.
CCNA focus: Know the differences between 802.1D and 802.1w. RSTP is backward-compatible but requires all switches to run it for full benefit.
PortFast and BPDU Guard: Securing Access Ports
PortFast bypasses STP listening/learning on access ports, letting them go directly to forwarding. This prevents delays when a PC boots up. BPDU Guard shuts down a PortFast-enabled port if it receives a BPDU—preventing rogue switch loops.
- Configuration:
spanning-tree portfaston access ports.spanning-tree bpduguard enableon the same port. - Behavior: If BPDU Guard triggers, the port enters errdisable state. Manually re-enable or use
errdisable recovery.
Exam scenario: An engineer enables PortFast on all access ports. A user plugs in a small switch, causing a loop. BPDU Guard catches it and disables the port.
10 Practice Questions for CCNA STP
Test your knowledge with these exam-style scenarios. Answers follow each question.
Root bridge election: Three switches have priorities 32768, 32768, and 4096. MAC addresses: 0000.0000.0001, 0000.0000.0002, 0000.0000.0003. Which switch becomes root?
Answer: The switch with priority 4096 (lowest priority) wins immediately, regardless of MAC.Port role identification: In a triangle topology with Switch A (root), Switch B, and Switch C, the link between B and C has a higher cost than B-A and C-A. What is the role of B’s port to C?
Answer: Alternate port (blocked). B’s root port is to A; C’s root port is to A. The B-C link is redundant.Port state transition: How long does a port stay in listening state on 802.1D?
Answer: 15 seconds (forward delay timer).RSTP vs STP: Which RSTP port role does not exist in standard STP?
Answer: Alternate port (though STP calls it a blocking port, RSTP formalizes it).BPDU Guard: A port configured with PortFast and BPDU Guard receives a BPDU. What happens?
Answer: The port goes into errdisable state. It must be manually re-enabled or configured with errdisable recovery.Root port selection: Switch B has two paths to root: cost 19 via Switch A, cost 38 via Switch C. Which port becomes root port?
Answer: The port with cost 19 (lower path cost).Designated port: On a segment between Switch D (root) and Switch E (non-root), which port is designated?
Answer: Switch D’s port (root bridge ports are always designated).STP convergence: A new link is added between two non-root switches. How long does STP take to converge (worst case)?
Answer: Up to 50 seconds (20s max age + 15s listening + 15s learning).RSTP edge port: What is the equivalent of PortFast in RSTP?
Answer: Edge port. It transitions directly to forwarding.Configuration mistake: An engineer sets STP priority to 65536. What happens?
Answer: Invalid. Priority must be a multiple of 4096 (0, 4096, 8192...). The switch may reject or default to 32768.
Common Pitfalls on the Exam
- Forgetting root bridge ports are always designated. This trips up many candidates.
- Mixing up port states with port roles. States (blocking, listening) are temporary; roles (root, designated) are fixed after election.
- Ignoring path cost. Lower is better. Use 100 Mbps = 19, 1 Gbps = 4, 10 Gbps = 2.
- Assuming RSTP is always faster. It still needs to block loops; the speed comes from negotiation, not magic.
Key Takeaways for CCNA Success
Master STP by understanding the root bridge election first—it dictates everything else. Practice identifying port roles in simple topologies. Know the timer values and how RSTP improves them. PortFast and BPDU Guard are your friends for access ports. The 10 questions above cover the most common exam traps.
Next step: Ready to test your skills under exam conditions? Courseiva offers a full CCNA practice lab with 50+ STP scenarios, including troubleshooting simulations. Explore the CCNA practice questions library to lock in your knowledge before exam day.