Spanning tree: the root, the roles, and why a loop melts a LAN
A layer-2 loop has no TTL to stop it. STP exists for that one reason, and it solves it by electing a root and then blocking exactly the right ports.
An IP packet has a TTL, so a routing loop costs 255 hops and then ends. An Ethernet frame has nothing of the sort. A loop at layer 2 forwards the same broadcast for ever, and because every switch floods it out every port, the number of copies doubles at every hop.
That is the whole reason spanning tree exists.
Elect a root
Every switch claims to be root and announces a bridge ID: priority, then MAC address. Lowest wins. Priority defaults to 32768 everywhere, so with no configuration the oldest switch in the building — the one with the lowest MAC — becomes the root of your network. That is not a design.
SW1(config)# spanning-tree vlan 1 root primary
SW1(config)# spanning-tree vlan 1 priority 4096
Then give every port a role
- Root port — on every non-root switch, the one port with the lowest cost
- Designated port — on every segment, the one port responsible for
- Blocking — everything left. These are the ports that would have made
A blocked port still listens. It is not shut down; it receives BPDUs and will take over within seconds if the topology changes.
SW2# show spanning-tree vlan 1
Interface Role Sts Cost Prio.Nbr Type
Gi0/1 Root FWD 4 128.1 P2p
Gi0/2 Altn BLK 4 128.2 P2p
What breaks it
- A switch with a lower MAC plugged in anywhere becomes root, and the
- A port that sends no BPDUs but is in a loop — a hub, an unmanaged
- portfast on a port that is not an end host. Portfast skips the listening
See it melt, safely
The redundant-triangle lab in the simulator has three switches in a ring. Turn spanning tree off and ping: the broadcast storm shows up immediately in the packet counters, every link saturates, and nothing gets through. Turn it back on and one port goes to Blocking. It takes about ninety seconds and it is worth doing once, because reading "a loop is bad" and watching one are not the same thing.
Join the discussion
Replies, likes and bookmarks live in the community half, which needs a free account. Writing here is free too, and everything is reviewed before it is published.
Open this in the communityEverything publishedHow this works