Spanning Tree Protocol (STP)
Overview
Section titled âOverviewâ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.
Key Concepts
Section titled âKey ConceptsâSTP Purpose
Section titled âSTP Purposeâ- 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
How STP Works
Section titled âHow STP Worksâ- Bridge Election: Selects a root bridge using Bridge ID (priority + MAC address)
- Path Selection: Determines lowest-cost paths to the root bridge
- 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
BPDU (Bridge Protocol Data Unit)
Section titled âBPDU (Bridge Protocol Data Unit)â- Control frames exchanged between switches
- Contains information about the root bridge and path costs
- Sent every 2 seconds by default
STP Variants
Section titled âSTP Variantsâ802.1D (Original STP)
Section titled â802.1D (Original STP)â- Standard Spanning Tree Protocol
- Convergence time: 30-50 seconds
- Limited scalability
Rapid STP (RSTP - 802.1w)
Section titled âRapid STP (RSTP - 802.1w)â- Improved convergence: 1-2 seconds
- All ports participate in topology change detection
- Active on most modern networks
Multiple STP (MSTP - 802.1s)
Section titled âMultiple STP (MSTP - 802.1s)â- Groups VLANs into instances
- Reduces overhead for large networks
- Better scalability
Bridge Priority
Section titled âBridge PriorityâBridge ID Components
Section titled âBridge ID Componentsâ- Priority: 0-65,535 (default: 32,768)
- MAC Address: Unique identifier per switch
Calculation
Section titled âCalculationâPriority = Bridge Priority Value + VLAN ID(Lower value = higher priority)Port States
Section titled âPort Statesâ| State | Duration | Purpose |
|---|---|---|
| Disabled | N/A | Port administratively down |
| Blocking | 20 sec | Receives BPDUs, no forwarding |
| Listening | 15 sec | Prepares to forward |
| Learning | 15 sec | Learns MAC addresses |
| Forwarding | Active | Forwards frames and BPDUs |
Cost Calculation
Section titled âCost CalculationâPath Cost (802.1D Default)
Section titled âPath Cost (802.1D Default)â| Bandwidth | Cost |
|---|---|
| 10 Mbps | 100 |
| 100 Mbps | 19 |
| 1 Gbps | 4 |
| 10 Gbps | 2 |
Lower cost = preferred path
Section titled âLower cost = preferred pathâConfiguration Examples
Section titled âConfiguration ExamplesâSet Bridge Priority
Section titled âSet Bridge PriorityâSwitch(config)# spanning-tree vlan 1 priority 4096Set Port Cost
Section titled âSet Port CostâSwitch(config-if)# spanning-tree cost 10View STP Status
Section titled âView STP StatusâSwitch# show spanning-treeSwitch# show spanning-tree detailSwitch# show spanning-tree vlan 1Common Issues & Solutions
Section titled âCommon Issues & SolutionsâSlow Convergence
Section titled âSlow Convergenceâ- Problem: Network unresponsive after topology change
- Solution: Implement RSTP or tune STP timers
Unnecessary Blocking
Section titled âUnnecessary Blockingâ- Problem: Some ports remain blocked unnecessarily
- Solution: Adjust bridge priorities and port costs
Broadcast Storms
Section titled âBroadcast Stormsâ- Problem: Excessive network traffic
- Solution: Verify STP is running and converged
Best Practices
Section titled âBest Practicesââ 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
CCNA Exam Tips
Section titled âCCNA Exam Tipsâ- 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