What Is a Switching Loop?

What Is a Switching Loop?

Computer networks represent a complicated infrastructure of data exchange. To make this possible, switches are made to establish a connection between a device and data transfer. If the switch is not set up properly, an issue called the layer 2 switching loop will occur.

A switching or bridge loop happens when two interconnecting switches are not connected properly, and there is more than one path between the source and destination. They can create traffic build-up because they cannot stop on their own once they are started. They can be prevented with the spanning tree protocol.

To learn how a switching loop is created and how you can prevent it, stick with me until the end of this article.

Network Performance

A switching loop can have a large effect on network performance by creating a broadcast storm. This basically means that broadcast packets are being constantly sent through ports by switches, and if the origin and destination are not configured properly, the data packages would become stuck between two points. 

The issue with the switching loop is that it will not stop on its own – once it starts, it’s like an endless journey from one to the other port. The thing is that this will eventually create a broadcast build-up and the network would probably crash.

Switches are designed to send a broadcast packet to a specific destination based on a MAC address. Every device has a unique MAC address, so there is no chance there will be confusion between two devices with the same address. Every device is unique, just like a fingerprint.

When there are several MAC addresses included in the process, the problem becomes even bigger. Once you send a package via a network with a switching loop, it will begin to bounce back or loop around, creating traffic and confusion that will make the network very unstable.

Spanning Tree Protocol

Switching loops are created when there is more than one layer 2 path in the network. Layer 2 is one of the seven data link layers and is in charge of data transfer from the network via the physical layer. 

An STP or Spanning Tree Protocol is designed to prevent the switching loops by helping broadcast packages to find the fastest path in the network, considering there is more than one in existence.

How Does It Work?

For the STP to be able to work, there is the necessity to point out and elect one root bridge out of all switches in the domain network. The root bridge is also called a root switch. It will act as a reference point to all the other switches in the network.

Root bridges are unique in a network that is using STP, there can never be more than one root bridge. This is because they are “stuck” in forwarding mode, which is actually what justifies their title. 

All the other switches are required to have a designated port, and that is usually the interface that is closest to the root switch. This root port will allow the traffic to cross the interface. All remaining ports will be marked as designated ports. These ports must allow traffic in order to be designated.

If you have a situation where multiple ports are connected to one switch, you will have an issue called a switching loop. Without the STP the network would suffer from overload and would crash.

The STP will find a designated port by allowing the switch to select the port with the fastest and shortest path, thus eliminating packages without a specific destination bouncing in the system.

Once the root port and designated port are selected, the STP will also lock all the remaining ports thus preventing the package to go into a loop by entering a path that it was not supposed to take.

In a network configuration that is using an STP, the loops are being prevented, and the network is recalculating its settings automatically every time you introduce a new switch to that specific network. Like this, you don’t have to worry if you forgot to set it up manually.

All the switches communicate by using a BPDU which stands for Bridge Protocol Data Units. Basically, every time a switch doesn’t respond to a message sent, the system makes an assumption that the switch is down, and starts the STP recalculation process.

5 States of the Port

Every port in the network that is configured to use an STP can find itself in one of the five possible states. Every port in the system must be in one of these five states at any given time.

The first one is the blocking state, which means that the STP is blocking any piece of information to flow via that particular port. 

This happens based on the system decision – the system evaluates the possibility of loop creation if it allows the package to travel through a specific interface. If the interface poses a threat, the port will be blocked.

The listening state is the second one and happens when the spanning tree is converging to a point where the traffic is at a stall and not going through. At the same time, the STP is trying to find other devices in the system.

Learning state occurs when one specific port is gathering information about other devices available in the network, thus expanding the spanning-tree table.

The fourth state is the standard state of a port and is called a forwarding state. This is when the port is functioning normally, allowing traffic to go through and packages to communicate in between them by using an STP.

The last state is the most radical one and is called the disabled state. This is when a port is completely shut from any participation in the traffic flow. This can happen due to many reasons and is usually done by an administrator.

Recent Posts