Routelearn.net
Course menu

Course 6: Spanning Tree ProtocolLesson 1.1 (1 of 24 in this course)22 of 91 in the CCNA series

Why is Spanning Tree needed?

Redundant links keep a network running, but without protection they create switching loops.

Beginner · 6 min read

A switching loop is a condition in which redundant links between switches give frames a circular path, so broadcast and unknown unicast frames are forwarded around the loop again and again. Because Ethernet frames have no TTL field, the copies never expire, which causes broadcast storms, unstable MAC address tables and duplicate frames.

In simple terms: Extra cables between switches add backup paths, but they also let frames go round in circles forever. Spanning Tree exists to stop that.

Redundancy is a good thing

Situation: an office has three switches, connected in a line: SW2 – SW1 – SW3. If one cable breaks, half the office is cut off. So the designer adds a third cable, SW2 – SW3. Now the switches form a triangle. Any one cable can break, and every switch can still reach every other switch.

This is called redundancy: a spare path that takes over when the main one fails. Almost every business network has it. For example, each access switch has two uplinks, and there are two core switches. But redundancy causes a big problem for Ethernet.

What happens without protection

Follow a single broadcast frame, such as an ARP request from PC A:

SW1SW2SW3PC APC B
  1. 1. One frame. PC A sends one broadcast.
  2. 2. Flooded. A switch sends a broadcast out of every port except the one it came in on. This is called flooding. So SW2 sends one copy to SW1 and one to SW3.
  3. 3. Flooded again. SW1 sends its copy on to SW3. SW3 sends its copy on to SW1 (and to PC B).
  4. 4. Back where it started. Both copies come back to SW2, and SW2 floods them again. Nothing ever stops them.

Why the frames never stop

An IP packet has a TTL (time to live) number. Every router lowers it by one. When it reaches zero, the packet is thrown away. So a packet stuck in a routing loop dies after a while. An Ethernet frame has no TTL. Switches pass it on without changing it. So in a loop, the frame goes round and round until the loop is removed.

The three problems a loop causes

ProblemWhat you seeWhy
Broadcast stormLinks are 100% busy, switches are overloaded, and the whole network stops workingEvery switch copies every broadcast again and again. New broadcasts keep adding more.
MAC table instabilityThe same MAC address keeps jumping between ports ("MAC flapping"), and the switch logs itCopies of PC A's frame arrive on different ports, so the switch keeps changing its mind about where PC A is
Duplicate framesHosts receive the same unicast frame several timesA frame for an unknown MAC address is flooded around the loop and arrives more than once

⚠️ A broadcast storm can stop a whole network within seconds. It can happen very easily: for example, someone plugs both ends of one cable into the same switch, or connects two wall sockets together.

So the network needs both

You want the spare links, so the network survives a broken cable. You also want no loops, so the network stays stable. Spanning Tree Protocol (STP) gives you both. All the cables stay connected, but STP turns off just enough ports to remove every loop. The next lesson shows how.

Check yourself

Predict · scenario 1

Why can a routing loop eventually clear itself, while a switching loop can't?

Predict · scenario 2

A switch logs that PC A's MAC address keeps moving between Gi1/0/1 and Gi1/0/2. What's the most likely cause?