Labs / The Switchyard / Switching, STP & link aggregation

Lab 2 of 4 · Switching, STP & link aggregation

Spanning tree: a loop on purpose, and the protocol that breaks it

Build a loop of three switches and watch spanning tree block one port.

Open this lab Pro 6 steps

The idea

Three switches, coreSwitch, floorA and floorB, are cabled in a loop, with alice and bob plugged in. You will see one broadcast circle the loop, then spanning tree elect a root and block one port so frames cannot circle.

One broadcast, two copies, no end
One broadcast, two copies, no end
The tree before and after the cut
The tree before and after the cut

Steps

  1. Three switches, a loop

    The switches are cabled in a triangle: two ways round. List floorB's ports; then we turn spanning tree off, alice sends one broadcast, and bob counts what reaches him.

    floorB:~# bridge link show
    alice:~# arping -c1 -w1 -I eth0 10.0.1.12
    bob:~# timeout 3 tcpdump -nni eth0 -w /dev/null arp
  2. Electing a root

    Spanning tree first elects one switch, the root, so that every switch measures its way from the same place. coreSwitch's priority is 4096, floorA's 8192, floorB's the default 32768. Ask floorB which switch it believes is the root.

    floorB:~# ip -d link show br0
    coreSwitch:~# ip -d link show br0

Pro

4 more steps in the app

  1. One port blocked: the loop is gone
  2. Moving the root
  3. A cable fails: the blocked port takes over
  4. BPDUs: how the switches talk
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab