5

I am trying to think of a mechanism to use repeaters to detect loops and then shutdown ports in order to break the loops. Is it possible for any solution to work 100%?

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311

2 Answers2

30

There's a standard protocol for that, called the Spanning Tree Protocol.

As the name suggests, it works by building a spanning tree of the network — a subset of the network that includes all nodes but contains no loops — and then disabling any ports that aren't part of the spanning tree. If a link in the spanning tree fails, e.g. if someone unplugs a cable, the protocol can automatically update the spanning tree and activate another path (that was previously disabled because it would've formed a loop).

Update: STP is superseded by IEEE 802.1aq shortest-path bridging.

Wyzard
  • 6,472
6

Smart switches that implement the Spanning Tree Protocol (STP) will attempt to break loops by selectively shutting down ports if they detect their own BPDU packets getting back to them. In addition, their security protocols may shutdown ports where any BPDU was detected, if said port was designated to be single-terminal only.

That said, pure repeaters and hubs are not generally aware of the concept of a network packet, let alone of a network loop. They operate at the physical layer (L1), often doing little more than amplifying the signal and trying to keep the port clocks synchronized. And most (all?) unmanaged switches are not really any better when it comes to network loops.

thkala
  • 2,129