# Switching loop

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Switching_loop
> Markdown URL: https://mediated.wiki/source/Switching_loop.md
> Source: https://en.wikipedia.org/wiki/Switching_loop
> Source revision: 1345055167
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{short description|Layer 2 network routing loop}}
{{About|situations where a packet can return to a layer-2 switch via another path|situations where a packet returns to a router via the same link|routing loop}}
{{More citations needed|date=January 2021}}

A '''switching loop''' or '''bridge loop''' occurs in [computer network](/source/computer_network)s when there is more than one [layer 2](/source/layer_2) path between two endpoints (e.g., multiple connections between two [network switch](/source/network_switch)es or two ports on the same switch connected to each other). The loop creates [broadcast storms](/source/broadcast_radiation) as broadcasts and [multicast](/source/multicast)s are forwarded by switches out every [port](/source/Computer_port_(hardware)), the switch or switches will repeatedly rebroadcast the broadcast messages flooding the network.<ref>{{Cite web|url=https://accedian.com/blog/identify-fix-network-switching-loop/|title=How to identify and quickly fix a network switching loop / switching loops?|date=May 19, 2016}}</ref> Since the layer-2 header does not include a [time to live](/source/time_to_live) (TTL) field, 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 [link aggregation](/source/link_aggregation), [Shortest Path Bridging](/source/Shortest_Path_Bridging), [Spanning Tree Protocol](/source/Spanning_Tree_Protocol) or [TRILL](/source/TRILL) on the network switches.

==Broadcasts==
In the case of broadcast packets over a switching loop, the situation may develop into a [broadcast storm](/source/broadcast_storm).

In a very simple example, a switch with three ports, A, B, and C has a normal [node](/source/Node_(networking)) 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](/source/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](/source/media_access_control) (MAC) database and can cause endless unicast [frames](/source/call_stack) to be broadcast throughout the network. A loop can make a switch receive the same broadcast frames on two different ports, and alternately associate the sending MAC address with 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 the 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.{{cn|reason=Specify how|date=September 2021}}

==TTL==
[Routing loop](/source/Routing_loop)s are tempered by a [time to live](/source/time_to_live) (TTL) field in [layer-3](/source/layer-3) packet header; Packets will circulate the routing loop until their TTL value expires. No TTL concept exists at [layer 2](/source/layer_2) and packets in a switching loop will circulate until dropped, e.g., due to resource exhaustion.

== See also ==
* [Ring network](/source/Ring_network)
* [Ethernet Ring Protection Switching](/source/Ethernet_Ring_Protection_Switching)

== References ==
{{Reflist}}

{{DEFAULTSORT:Switching Loop}}
Category:Network performance
Category:Network topology

---
Adapted from the Wikipedia article [Switching loop](https://en.wikipedia.org/wiki/Switching_loop) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Switching_loop?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
