3.2.2. Spanning Tree Protocol
Redundant links prevent single points of failure—but they create Layer 2 loops. Without STP, a broadcast frame travels both paths, creating copies that travel both paths, exponentially multiplying until the network crashes (broadcast storm).
STP (Spanning Tree Protocol): Prevents loops by blocking redundant paths while keeping them available for failover.
802.1D Port States:
- Blocking: Not forwarding frames; listening to BPDUs to learn topology
- Listening: Processing BPDUs, participating in root bridge election
- Learning: Building MAC table but still not forwarding
- Forwarding: Normal operation—learning and forwarding
- Disabled: Administratively shut down
Port Roles:
- Root Port: Best path to root bridge (one per non-root switch)
- Designated Port: Best path for a segment to reach root
- Blocked/Alternate: Backup path, kept in standby
Root bridge election: The switch with the lowest bridge ID becomes root. Bridge ID = priority (default 32768) + MAC address, so if nobody changes the priority, the switch with the lowest MAC address wins.
Convergence: Classic 802.1D STP takes 30–50 seconds to reconverge (up to 20 s max age, then 15 s listening and 15 s learning). RSTP (802.1w) replaces the timers with a handshake between switches and converges in a few seconds.
Edge-port features:
| Feature | What it does |
|---|---|
| PortFast | Moves an end-device port straight to forwarding, skipping the ~30 s of listening and learning (so DHCP isn't delayed) |
| BPDU Guard | Used with PortFast on access ports: error-disables the port if a BPDU arrives, so a switch plugged in there can't join STP or become root |
| Root Guard | Used on ports facing other switches, which legitimately send BPDUs: blocks the port if a BPDU claims a better root |
MTU and Jumbo Frames:
- MTU (Maximum Transmission Unit): Largest frame size allowed (standard Ethernet: 1500 bytes)
- Jumbo frames: Larger MTU (typically 9000 bytes) for reduced overhead on storage/backup traffic
- Must be configured consistently across entire path—MTU mismatch causes fragmentation or drops