How does STP prevent network loops?
67
✓
✓ Best Answer
Spanning Tree Protocol (STP), IEEE 802.1D, prevents Layer 2 loops by blocking redundant paths while keeping backup ready.
The Loop Problem
Without STP, redundant links cause broadcast storms — frames circulate infinitely, MAC tables corrupt, and the network collapses within seconds.
STP Algorithm
- Elect root bridge: Switch with lowest bridge ID (priority + MAC)
- Calculate least-cost paths: Each switch finds shortest path to root
- Select root ports: One per non-root switch, closest to root
- Select designated ports: Best port per segment toward root
- Block other ports: Remaining redundant ports become blocking
Port States (Classic STP)
- Disabled: Administratively down
- Blocking: Receives BPDUs only
- Listening: Transitional
- Learning: Building MAC table
- Forwarding: Normal operation
Convergence Time
Classic STP: 30-50 seconds (way too slow for modern networks). This is why RSTP replaced it.
Enhanced Variants
- RSTP (802.1w): 1-3 second convergence
- MSTP (802.1s): Multiple instances for VLAN groups
- PVST+ / Rapid-PVST+: Per-VLAN spanning tree (Cisco)
Best Practices
- Always use RSTP or MSTP, never classic STP
- Explicitly configure root bridge (don't rely on election)
- Enable BPDU Guard on access ports
- Enable Root Guard on downlinks
- Consider ring-specific protocols (ERPS, MRP) for pure rings
2 Other Answers
15
Classic STP is basically deprecated. RSTP or nothing.
11
Always explicitly set root priority — auto-election has bitten many people.
Your Answer
You must be signed in to post an answer.