Switching loop


A switching loop or bridge loop occurs in computer networks when there is more than one Layer 2 path between two endpoints. The loop creates broadcast storms as broadcasts and multicasts are forwarded by switches out every port, the switch or switches will repeatedly rebroadcast the broadcast messages flooding the network. Since the Layer 2 header does not support a time to live value, if a frame is sent into a looped topology, it can loop forever.
A physical topology that contains switching or bridge loops is attractive for redundancy reasons, yet a switched network must not have loops. The solution is to allow physical loops, but create a loop-free logical topology using the shortest path bridging protocol or the older spanning tree protocols on the network switches.

Broadcasts

In the case of broadcast packets over a switching loop, the situation may develop into a broadcast storm.
In a very simple example, a switch with three ports A, B, and C has a normal node connected to port A while ports B and C are connected to each other in a loop. All ports have the same link speed and run in full duplex mode. Now, when a broadcast frame enters the switch through port A, this frame is forwarded to all ports but the source port, i.e. ports B and C. Both frames exiting ports B and C traverse the loop in opposite directions and reenter the switch through their counterpart port. The frame received on port B is then forwarded to ports A and C, the frame received on port C to ports A and B. So, the node on port A receives two copies of its own broadcast frame while the other two copies produced by the loop continue to cycle. Likewise, each broadcast frame entering the system continues to cycle through the loop in both directions, rebroadcasting back to the network in each loop, and broadcasts accumulate. Eventually, the accumulated broadcasts exhaust the egress capacity of the links, the switch begins dropping frames, and communication across the switch becomes unreliable or even impossible.

MAC database instability

Switching loops can cause misleading entries in a switch's media access control database and can cause endless unicast frames to be broadcast throughout the network. A loop can make a switch receive the same broadcast frames on two different ports, and alternatingly associate the sending MAC address with the one or the other port. It may then incorrectly direct traffic for that MAC address to the wrong port, effectively causing this traffic to be lost, and even causing other switches to incorrectly associate the sender's address with a wrong port as well.

Multiple frame transmissions

In a redundant switched network it is possible for an end device to receive the same frame multiple times.

Misinterpretations

It is not true that within a switching loop packets will circulate the network until their time to live value expires, as no TTL concept exists at Layer 2. In practice, the packet will circulate until it is dropped, e.g. due to resource exhaustion.