In theory, how would you set up a mechanism by which repeaters/hubs could detect loops and shutdown ports to break the loop?

5

1

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%?

user309979

Posted 2014-03-24T01:26:28.073

Reputation: 69

Question was closed 2014-03-25T21:06:33.187

2I'd say it's possible for it to work 110% - I recently tangled with an issue where a Cisco switch was a little too trigger-happy shutting down ports permanently... – thkala – 2014-03-24T07:46:03.470

1How are cycles (not loops) in the network (which is an undirected graph) a problem? It is GOOD that there is more than one path from A to B, even if it is not parallel to an existing connection. TCP guarantees that if a packet sent 2nd comes a faster route (and thus first) that it will be re-ordered before the application is given the data, UDP is fire-and-forget, it could get there in any order at any time (ish) if it gets there at all, it could come any route. – Alec Teal – 2014-03-24T11:32:59.103

2@AlecTeal, at the IP layer, it's good to have multiple paths for routers to choose between. But at the Ethernet layer, which doesn't have routing the way IP does, cycles in the network cause broadcast frames to be repeated in a loop forever. – Wyzard – 2014-03-24T11:58:57.353

2@Wyzard: The question starts out with "in theory...". Assuming a particular limited technology is irrelevant. In theory we can have Ethernet with STP. – MSalters – 2014-03-24T13:20:35.057

I agree with MSalters we already have STP that makes this basically irrelevant on intelligent switches. – mikebabcock – 2014-03-24T15:05:41.580

Answers

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

Posted 2014-03-24T01:26:28.073

Reputation: 5 832

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

Posted 2014-03-24T01:26:28.073

Reputation: 1 769