2.3 Spanning Tree Protocol
Preventing Layer 2 broadcast storms. Master Root Bridge elections, Rapid PVST+ optimizations, and critical edge-port security mechanisms.
Core Explanations
The Layer 2 Loop Problem
Redundancy is critical, but Layer 2 Ethernet headers do not have a TTL (Time to Live) field. If a physical loop exists between switches, broadcast frames will circulate endlessly, creating a Broadcast Storm that will melt the network in seconds. STP logically blocks redundant links to create a loop-free topology.
The Root Bridge Election
Switches elect a 'boss' switch called the Root Bridge using Bridge Protocol Data Units (BPDUs). The switch with the lowest Bridge ID (BID) wins. The BID is calculated by combining the Switch Priority (default 32768) + the Switch MAC Address.
Rapid PVST+ (802.1w)
Legacy STP (802.1D) could take 30 to 50 seconds to recover from a link failure. Cisco's default modern standard is Rapid Per-VLAN Spanning Tree Plus (Rapid PVST+), which provides sub-second convergence and runs a separate STP instance for every VLAN.
IOS Command Reference
Controlling the Root Bridge Election
Host Port Optimizations
Verification & Troubleshooting
CCNA Exam Gotchas
PortFast is DANGEROUS on Trunks
Never enable PortFast on a trunk link or a port connected to another switch. Because PortFast skips the STP listening/learning phases, a temporary loop can form instantly and crash the network. It is exclusively for end-device access ports.
The Default Priority Trap
If you do not manually set a Root Bridge, the switch with the lowest MAC address wins. MAC addresses are assigned sequentially at the factory, meaning your oldest, slowest switch will likely become the Root Bridge. Always hardcode your core switches as primary/secondary roots!
System EXT ID (VLAN ID)
Because Cisco uses PVST+, the switch actually adds the VLAN number to the base priority. If you leave the priority at default (32768) for VLAN 10, the actual priority shown in 'show spanning-tree' will be 32778 (32768 + 10).