Networks are built using multiple, interconnecting switches that connect devices and transfer data. However, if two switches aren't connected properly, something called a switching loop is created. To prevent this from happening, it's important to know why and how they occur.
In a typical local area network (LAN), it's common for multiple switches to be interconnected for redundancy, meaning more than one path is possible between two switches. Redundancy is a safety measure that ensures the network won't fail completely if a link breaks. However, with interconnected switches comes a potential problem: a Layer 2 switching loops.
A switching loop, or bridge loop, occurs when more than one path exists between the source and destination devices. As broadcast packets are sent by switches through every port, the switch repeatedly sends broadcast messages, flooding the network and creating a broadcast storm.
When switching loops start, they don't stop; there's no time-to-live (TTL) value on the broadcast packets, meaning they'll keep bouncing around forever between two switches. And herein lies the real problem—as the loop continues, so does the build up blocking traffic between switches.
Switches determine where a packet goes based on the destination MAC address; every device has a unique MAC address, so every packet is directed to a single place. When multiple MAC addresses broadcast to all devices in the network, it can become problematic. This is especially true for switch loops, where all broadcasts and multicasts repeat around the looped network path in rapid succession, very quickly bringing down the network.
If a broadcast packet is sent out over a network with a loop, it will continue to rebroadcast the message as it loops around the network. As more traffic packets pass through the network, they're added to the loop; soon, the network is unable to communicate at all because it's spending all of its time sending data packets through the loops.
Fortunately, there's a way to prevent this from happening using the Spanning Tree Protocol.
The Spanning Tree Protocol (STP) is a networking standard designed specifically to prevent loops in Layer 2 switching, and to select the fastest network path if there are redundant links in the network.
Here's how STP works:
Thanks to STP's automated configuration mentioned above, network communication can occur without worrying about any loops causing disruptions. When a new switch is introduced to the network, the spanning tree algorithm and port states are recalculated to prevent a loop.
Switches communicate with Bridge Protocol Data Units (BPDU), which are frames that contain information about STP, every two seconds. If the remote switch doesn’t respond, it's assumed that the switch and its links are down, and the spanning tree algorithm is recalculated.
If a port on a switch has been configured to use the Spanning Tree Protocol, there are a certain set of states that this particular port might be in.
ManageEngine OpManager is comprehensive network monitoring software that offers monitoring for switch availability, health, and performance. OpManager's switch monitoring automatically discovers switches in a network and places them on a special switch map. All the switch ports are also discovered and intuitively placed on the map. Using OpManager's switch monitoring, operators can gain visibility into the status and availability of switch ports. OpManager actively monitors switch ports and quickly notifies operators whenever the port or switch goes down. IT admins can configure OpManager to monitor only critical ports, an industry best practice for switch monitoring, which prevents unnecessary alarms from being generated.
OpManager comes bundled with real-time switch monitoring tools like the Switch Port Mapper, which can quickly list devices connected to switch ports along with their MAC addresses and critical parameters, and a feature for on-demand STP port details. By enabling this option, admins can view valuable information about the spanning tree state of each port, such as which ports are blocking and which are forwarding.
Explore OpManager using our online demo, or download OpManager's free, 30-day trial here.
A switching loop occurs when more than one path exists between the source and destination devices. With switching loops, when broadcast packets are sent by switches through every port, the switch repeatedly sends broadcast messages, flooding the network and creating a broadcast storm.
A switching loop forms when there is more than one layer 2 path(redundancy) between two endpoint devices.
Switching loops can be prevented using Spanning Tree Protocol (STP). The purpose of Spanning Tree Protocol is to select the fastest network path if there are redundant links in the network.