Spanning Tree Protocol (STP)

STP prevents Layer 2 loops by selectively blocking ports. Without STP, a redundant link would cause broadcast storms, MAC instability, and network failure.

1. The Root Bridge Election

Every STP domain must have one Root Bridge. It is the focal point of the topology.

Best Practice: Always configure `spanning-tree vlan 10 priority 4096` on your core switch. Never leave election to chance (random MACs).

2. Port Roles & States

Once the Root is elected, every other switch calculates the shortest path to the Root.

Role Description State
Root Port (RP) The single port on a switch closest to the Root Bridge. Forwarding
Designated Port (DP) The port sending BPDUs away from the Root. One per link. Forwarding
Alternate Port (Alt) A redundant path. Kept as a backup. Blocking / Discarding

3. STP Flavors: 802.1D vs RSTP vs MST

Protocol Std Convergence Resource Usage
PVST+ (Legacy) Cisco Slow (30-50s) High (1 Instance per VLAN)
Rapid-PVST+ 802.1w Fast (<1s) High (1 Instance per VLAN)
MST (Multiple STP) 802.1s Fast (<1s) Low (Maps multiple VLANs to 1 Instance)

4. Rapid STP (802.1w) Mechanics

RSTP achieves sub-second convergence by introducing the Proposal/Agreement mechanism. It does not rely on timers expiring.

Edge Ports (PortFast)

Ports connecting to end hosts (PCs, Printers) should be configured as Edge Ports. This skips the Proposal/Agreement process and goes straight to Forwarding. Without this, DHCP can timeout while the port initializes.


References