Definition
A network loop happens when network devices are accidentally wired into a ring, so data signals can't find their destination and circle forever. The trapped data multiplies like a snowball and paralyzes the entire network almost instantly.
Cars Trapped in a Roundabout With No Exit
At karaoke, if you hold the mic right in front of the speaker, you get an ear-splitting squeal. Sound comes out of the speaker, goes into the mic, comes out of the speaker louder, and the cycle repeats endlessly in a split second. That is called audio feedback.
The same kind of mess can happen in a computer network. Offices and schools often use several switches (devices that connect computers and pass traffic between them), and the cables easily get tangled. Sometimes someone accidentally plugs two cables between the same two devices, or plugs a cable back into the same switch it came from.
Now the traffic has a roundabout with no exit. Data signals can't get out, so they start spinning wildly between the devices. When data is trapped in a closed ring and circulates forever like this, it is called a network loop.
A Closer Look
If the data just goes around in circles, why would the whole internet stop? Two special rules of how networks work are hiding here.
First, unlike ordinary web traffic, the basic signals on a local area network (LAN) have no lifespan, or TTL (Time To Live). Data on the internet usually has a limit on how many times it can be passed along, and it disappears once that limit runs out. But the basic data moving between switches can keep circling until someone cuts the power or pulls a cable.
Second, when a network switch receives a signal meant for everyone (a broadcast), or a signal whose destination it doesn't know yet, it sends an identical copy out of every connected port. In a loop, copies keep chasing each other around, and within seconds millions of junk copies pile up.
This is a broadcast storm. The whole highway fills up with lost ghost cars, and the real traffic can't move a single step.
The Smart Traffic Light That Prevents the Freeze
So if you never wire a network in a ring, is the problem solved? Surprisingly, big companies and server rooms connect their cables in rings on purpose. That way, if the main link breaks, signals can switch to a backup link and the internet stays up.
To block loops and still use the backup roads safely, engineers invented a clever technology called the Spanning Tree Protocol (STP). STP is a set of rules that lets network devices talk to each other and build a map of the whole network.
When the devices notice that a ring has formed, they use software to 'temporarily block' one of the backup paths. Normally only one path is left open between devices, which stops loops at the source. If the main path breaks, the blocked path opens again. The original STP took about 30 seconds to reopen a path, so today people mostly use improved versions like RSTP, which does it in about a second. Thanks to this, we can use the internet reliably without the whole network freezing.
Common misconceptions
A network loop only happens because of a sophisticated hacker attack.
Most loops come from simple physical mistakes, like plugging a LAN cable into the wrong port while moving desks or cleaning, or forgetting a setting on a hub or switch.
Where you meet it
Someone plugged both ends of a loose LAN cable from the office floor into the same switch, and the entire office's Wi-Fi and internet went dead.
A backup LAN cable was connected between switches in case of failure, but loop protection (STP) was turned off, so the network froze the moment it was plugged in.
In one sentence
A network loop is when network devices get connected in a ring, data circles endlessly, and the whole network is paralyzed.