STP Fundamentals
Redundancy means parallel paths, and parallel paths mean loops. The Spanning Tree Protocol is the layer of calm underneath every switched network: it elects a root, blocks just enough ports to break every loop, and keeps the rest forwarding. This lesson is the mathematics of that calm — bridge IDs, BPDUs, path costs, port roles, and the five port states.
- Explain the loop problem: broadcast storms, duplicate frames, and MAC table instability.
- Describe the root bridge election using the lowest bridge ID (priority + MAC).
- Understand BPDUs and the frames STP exchanges.
- Identify the port roles: root, designated, and non-designated (blocking).
- List the five STP port states and their real cause: blocking, listening, learning, forwarding, disabled.
- Interpret path cost and the default timers (hello 2 s, forward delay 15 s, max age 20 s).
The loop problem
Add a second link to a network for redundancy and you create a forwarding loop. Three disasters follow, and the exam names all of them:
- Broadcast storms — a broadcast frame is flooded out every port, reaches the same switch again through the loop, and is flooded again. Traffic multiplies exponentially until the network is saturated.
- Duplicate frames — a unicast frame can reach a switch by more than one path, so the destination receives two copies. Protocols trying to keep state (such as ARP or TCP acknowledgements) are confused by the doubles.
- MAC table instability — the same source MAC keeps arriving on different ports as frames circulate, so the switch’s learning algorithm repoints the entry at every arrival, thrashing the table and mis-forwarding traffic.
STP exists to prevent these by making sure a loop never exists in the first place. It does not add bandwidth; it removes paths until the active topology is a single tree.
The spanning tree idea
STP’s algorithm has three steps: elect a root bridge, pick the best path to the root from every other switch, and block every port that is not on such a path. The result is a tree rooted at the root bridge. Every switch other than the root has exactly one port that leads toward the root (its root port), every LAN segment has exactly one switch that owns it (the segment’s designated port), and every other port is blocked.
The bridge ID: priority + MAC
Every switch is identified in STP by its bridge ID, traditionally a combination of priority and MAC address:
- Priority — a 16-bit value that must be a multiple of 4096.
The default is 32768. Changing it (e.g.
spanning-tree vlan 1 priority 0) is how an administrator forces a switch to be root. - MAC address — the switch’s base MAC, used as the tie-breaker. When two switches advertise the same priority, the one with the lowest MAC wins.
On modern Cisco platforms the running identity is the extended system ID: the effective bridge ID combines the configurable priority plus the VLAN number, e.g. priority 32768 in VLAN 10 appears as 32778 (32768 + 10) in show output. The rule the exam wants is plain and stemless: the bridge with the lowest bridge ID wins the election, where bridge ID = priority + MAC, compared in that order.
Electing the root bridge
At startup every switch believes it is the root and sends BPDUs claiming so. As the BPDUs propagate, each switch compares the received bridge ID with its own and with those it has heard. The lower value wins, and the winner becomes the shared root. The election is stable because the bridge ID never changes — it is a property of the switch, not of the traffic. In a real design you pick the root deliberately (usually the core switch) and lower its priority, because someone will win the election whether you plan it or not.
BPDUs
STP’s vocabulary is the Bridge Protocol Data Unit, a Layer 2 frame sent to the multicast address 01:80:C2:00:00:00 (the STP multicast address). A BPDU carries the sender’s bridge ID, the root bridge ID as it knows it, the path cost to the root, and timers. The root bridge originates BPDUs with all the timer information; every other switch improves the root ID or the path cost and forwards accordingly. BPDUs are what make the tree self-healing: when a link dies, blocked ports stop hearing superior BPDUs and begin the transition to forwarding (Section 8).
Two BPDU types matter conceptually: Configuration BPDUs carry the normal election and topology information, and TCN (Topology Change Notification) BPDUs are sent whenever the topology changes so the root can flush stale forwarding entries and the network can converge on the new tree.
Path cost
Each link has a path cost derived from its bandwidth. The path cost to the root is the sum of the costs of the links along the path; the port whose path has the lowest total cost becomes the root port. The classic IEEE 802.1D costs:
| Link speed | IEEE 802.1D cost | Modern shortcut cost |
|---|---|---|
| 10 Mbps | 100 | 2,000,000 |
| 100 Mbps | 19 | 200,000 |
| 1 Gbps | 4 | 20,000 |
| 10 Gbps | 2 | 2,000 |
The exam usually tests the 802.1D column — and the fact that the cost is inverse to speed: faster link, smaller number. In the figure above, the 1 Gbps links cost 4 each, so SW2’s path to the root through SW3 is 4 + 4 = 8, worse than its direct path (4), which is why its direct port becomes the root port and the far-side port blocks.
Port roles: root, designated, non-designated
Once the root is known, every port in the network takes one of three roles:
- Root port — each non-root switch’s single best port toward the root. The root bridge itself has none of these (it is the root).
- Designated port — the one port on each segment that is permitted to send and receive; it is the segment’s best connection toward the root. Typically the root’s own ports are all designated.
- Non-designated port — every port that is neither root nor designated. In classic STP this port is placed in the blocking state and forwards nothing, standing by as the redundant path.
The heuristic that maps roles to ports: every switch has one root port; every link has one designated port on one side; everything else blocks. In the triangle figure, SW2 and SW3 each have a root port toward SW1; the link between SW2 and SW3 is owned by none and blocks.
The five port states
Ports do not start forwarding. They pass through states, and the exam expects the four memorable ones plus the disabled afterthought:
| State | Learning MACs? | Forwards frames? | Notes |
|---|---|---|---|
| Blocking | No | No | Listens for BPDUs; non-designated ports live here. |
| Listening | No | No | After max age expires; still deciding roles. |
| Learning | Yes | No | Populates the MAC table without forwarding yet. |
| Forwarding | Yes | Yes | Fully operational; normal data plane behaviour. |
| Disabled | No | No | Administratively down; not participating in STP. |
The order is always the same: Blocking → Listening → Learning → Forwarding. The exam’s favourite trap: learning populates the MAC table but does not forward frame data — it is the middle state that makes you want to say “it forwards” and lose the mark.
Timers and convergence
STP’s default timers are canonical numbers:
- Hello time — 2 seconds. The root sends a BPDU every 2 s.
- Forward delay — 15 seconds. The time spent in both Listening and Learning (15 + 15).
- Max age — 20 seconds. How long a port waits for a BPDU before considering the root gone.
Put them end to end and the cost of classic STP convergence is visible: after a failure, a blocked port waits max age (20 s), then Listening (15 s), then Learning (15 s) — up to about 50 seconds before forwarding resumes. That wait exists to guarantee no loop, but it is glacial by modern standards and is exactly why Rapid PVST+ (Lesson 19) exists.
Verification with show spanning-tree
S1# show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32768 Address aaaa.aaaa.aaaa This bridge is the root Bridge ID Priority 32768 Address aaaa.aaaa.aaaa Interface Role Sts Cost Prio.Nbr Type Gi0/1 Desg FWD 4 128.1 P2p Gi0/2 Desg FWD 4 128.2 P2p Gi0/3 Desg FWD 4 128.3 P2p
On SW1 (the root), every port is designated and forwarding. On SW2 the same command would show
Root for the root port and Altn BLK (alternate/blocked) for the port toward
the loop, which is how you read a network’s health at a glance: one switch shows all
designated; other switches show exactly one root port. Any switch reporting two root ports
has a misconfiguration.
The vocabulary you need
Every term below appears in the lesson text above. Select one to read its definition, then use the quiz at the end to check what stuck.
Review
Check what you have learned with these review questions.
Sources & references
- Cisco. CCNA (200-301) Exam Topics. cisco.com.
- IETF. Request for Comments (RFCs). rfc-editor.org.
- IANA. Internet Assigned Numbers Authority registries. iana.org.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.