Abstract
- Eliminates loops in a network topology made of switches and cables (Ethernet), which can occur when multiple switches are connected in a redundant manner
- The resulted paths form a tree, free of loops
Prevent crashing of the entire network
Ethernet has no TTL like IP packets, so a looping frame could literally go forever until the network dies.
As we have more and more looping frames in the network, we can crash the entire network!
STP is old!
STP was released in the 1980s, it has slow convergence times (~30secs), potentially causing temporary disruptions during topology changes.
We have RSTP for fast recovery, and MSTP for handling multiple VLANs efficiently. TRILL/SPB allows using all paths without loops (like smarter STP with load balancing).
Root Bridge
- The central point in the STP topology, chosen based on priority (default 32768, but you can configure it) and MAC address
STP Port
Root Port
- The port on each non-root bridge that provides the best path to the root bridge
Designated Port
- The port on each link between two switches that offers the best path to the root bridge
Blocked Port
- Redundant ports that are placed in a non-forwarding state to prevent loops
STP Port State
- The state is different stages a switch port goes through while STP decides if it should forward traffic or stay blocked, to prevent loops
5 states
- Disabled: Port is turned off / admin shut down. Not part of the “tree”
- Blocking: Port is on, but only listens for BPDUs, no user traffic goes through which avoids loops while STP is deciding
- Listening: Port listens to BPDUs to figure out if it should forward or block. Still doesn’t forward user traffic yet
- Learning: Port begins learning MAC addresses (filling up the switch’s MAC table). Still doesn’t forward user traffic yet.
- Forwarding: Port is fully active. Forwards user traffic and still processes BPDUs.
Listening and learning take about 30secs before a port starts forwarding frames.
STP Workflow
STP Election
- All switches exchange BPDUs (control messages)
- They elect one root bridge
STP Path Calculation
- Each switch calculates its shortest path to the bridge (using path cost which is measured with bandwidth of the cables)
STP Port Role Assignment
- The root port, designated port and blocked port are decided on the switches
STP Traffic Forwarding
- Once the “tree” is built, only the safe paths are active
- The blocked ports stay closed to frames, but if something changes (like a cable fails), STP can re-run, unblock that port, and rebuild the tree