Skip to content

Spanning Tree Protocol (STP)

Spanning Tree Protocol (STP) is a network protocol that prevents loops in Ethernet networks by disabling redundant paths. It ensures a single path between any two network switches, avoiding broadcast storms and network congestion.

  • Loop Prevention: Disables redundant links to prevent switching loops
  • Redundancy: Maintains backup paths that activate if the primary path fails
  • Network Stability: Ensures consistent network topology
  1. Bridge Election: Selects a root bridge using Bridge ID (priority + MAC address)
  2. Path Selection: Determines lowest-cost paths to the root bridge
  3. Port Roles Assignment:
    • Root Port: Shortest path to root bridge (per switch)
    • Designated Port: Forwards traffic toward root bridge (per segment)
    • Blocked Port: Unused ports that prevent loops
  • Control frames exchanged between switches
  • Contains information about the root bridge and path costs
  • Sent every 2 seconds by default
  • Standard Spanning Tree Protocol
  • Convergence time: 30-50 seconds
  • Limited scalability
  • Improved convergence: 1-2 seconds
  • All ports participate in topology change detection
  • Active on most modern networks
  • Groups VLANs into instances
  • Reduces overhead for large networks
  • Better scalability
  • Priority: 0-65,535 (default: 32,768)
  • MAC Address: Unique identifier per switch
Priority = Bridge Priority Value + VLAN ID
(Lower value = higher priority)
StateDurationPurpose
DisabledN/APort administratively down
Blocking20 secReceives BPDUs, no forwarding
Listening15 secPrepares to forward
Learning15 secLearns MAC addresses
ForwardingActiveForwards frames and BPDUs
BandwidthCost
10 Mbps100
100 Mbps19
1 Gbps4
10 Gbps2
Switch(config)# spanning-tree vlan 1 priority 4096
Switch(config-if)# spanning-tree cost 10
Switch# show spanning-tree
Switch# show spanning-tree detail
Switch# show spanning-tree vlan 1
  • Problem: Network unresponsive after topology change
  • Solution: Implement RSTP or tune STP timers
  • Problem: Some ports remain blocked unnecessarily
  • Solution: Adjust bridge priorities and port costs
  • Problem: Excessive network traffic
  • Solution: Verify STP is running and converged

✓ Use RSTP (802.1w) in modern networks ✓ Set root bridge explicitly (priority 0 or 4096) ✓ Configure secondary root bridge for redundancy ✓ Monitor STP convergence regularly ✓ Document network topology ✓ Test failover scenarios ✓ Tune timers only when necessary

  • Know STP port roles and states
  • Understand Bridge ID calculation
  • Be able to identify root bridge election
  • Know default STP timers (2, 15, 15, 20 seconds)
  • Understand RSTP improvements over 802.1D
  • Recognize topology change scenarios