Routelearn.net
Course menu

Course 6: Spanning Tree ProtocolLesson 1.2 (2 of 24 in this course)23 of 91 in the CCNA series

What Spanning Tree does

Turning a looped topology into a loop-free tree, while keeping the backup links ready.

Beginner · 5 min read

STP (Spanning Tree Protocol) is a Layer 2 protocol that turns a physical switch topology containing loops into a loop-free logical topology. It places selected switch ports in a blocking state so that exactly one active path connects any two switches, and unblocks a port if an active link fails.

In simple terms: STP leaves all the cables in place but switches off just enough ports to remove every loop. If a working link breaks, it switches a spare port back on.

Physical topology vs. logical topology

STP doesn't change the cables. It only changes which ports are allowed to forward traffic. The physical topology (how the cables connect) is still a triangle. The logical topology (the paths traffic can really use) becomes a tree. A tree has exactly one path between any two switches, so a frame has no circle to go round.

DPRPDPRPDPALTSW1priority 24576SW2priority 32768SW3priority 32768PC APC B
  1. 1. The same broadcast as the “Why is Spanning Tree needed?” lesson… PC A sends one broadcast.
  2. 2. SW2 floods it… to SW1 and to SW3, the same as before.
  3. 3. …but one port is blocked. STP has blocked SW3's port on the SW2–SW3 link. So SW3 throws away the copy from SW2.
  4. 4. Exactly one copy arrives. The copy from SW1 reaches PC B. There is no loop and no storm.

Why one blocked port is enough: a loop needs a full circle of forwarding ports. Break the circle in one place and the loop is gone. In bigger networks, STP blocks one port for every extra path.

What a blocked port still does

Blocked portForwarding port
Forwards user framesNo: throws them awayYes
Learns MAC addressesNoYes
Receives BPDUs (STP messages)Yes: keeps listeningYes
Link lightOn: the cable is upOn

A blocked port is not broken. It is a standby path. It keeps listening to STP messages, so it knows straight away when it is needed.

When a link fails, STP unblocks the backup

DPRPDPRPDPALTSW1priority 24576SW2priority 32768SW3priority 32768PC APC B
  1. 1. Normal. PC B reaches SW1 directly.
  2. 2. The SW1–SW3 cable fails. SW3 stops hearing from SW1 on that cable.
  3. 3. The backup takes over. STP unblocks SW3's port toward SW2. Now traffic goes through SW2. How fast this happens depends on the STP version (Modules 2 and 4).

What STP gives you

  • No loops: exactly one working path between any two switches.
  • Automatic backup: spare paths stay connected and are turned on when needed.
  • No manual work: the switches agree on it by sending messages to each other.

The downside: a blocked link carries no traffic while it waits, so some bandwidth is wasted. Per-VLAN Spanning Tree (Module 3) can block different links for different VLANs, so more links are used.

Check yourself

Predict · scenario 1

Does STP physically disconnect the redundant cable?

Predict · scenario 2

A network has 4 switches in a square (4 links). How many ports must STP block to remove the loop?