Loops in layers 2 and 3

Layer 2 loops

A layer 2 loop also known as a switching loop, or a bridging loop, is one where there is more than one layer 2 path between two endpoints. A layer 2 loop will take place when:

  • there are multiple connections between two network switches on the same VLAN
  • two ports on the same switch on the same VLAN are directly connected
  • three or more switches are connected in a physical loop using ports on the same VLAN

Unlike Layer 3 loops, which employ a time to live (TTL) function, switching loop packets will circulate the network until they are dropped, e.g. due to resource exhaustion.

Layer 2 loops are dealt with using features such as STP, EtherChannel, or the creation of VLANs within the topology

Layer 3 loops

A layer 3 loop also known as a routing loop takes place when routing is configured in such a way to send an IP packet continuously around the same path. This differs from a switching loop in that the loop is created due to routing decisions. This means that a looped IP packet will be routed from one interface to another (or from one VLAN to another) resulting in a continuously looped packet.

This is primarily due to misconfiguration or a routing algorithm error. Unlike Layer 2 loops, IP packets have a TTL value that is decremented every hop, and when it reaches zero, it is dropped. Layer 3 loops are mitigated against using TTL as well as using correct routing configurations.