Nicholas Morrison - Networking Specialist

flokinet-007 - Climbing the Spanning Tree

Spanning Tree

Spanning Tree blocks ports

When a loop is found, a link is chosen to be BLOCKED.

Example STP topology

Spanning Tree wants to find the root bridge

The protocol will attempt to keep a path open towards the ROOT BRDIGE.

Example STP topology

Spanning Tree is simple

It works with simple or complex topologies.

Example STP topology

The Spanning Tree Protocol (802.1d)

  • Spanning Tree prevents broadcast storms
  • .. by breaking Layer 2 loops
  • Spanning Tree flavours are plentiful
    • STP (802.1d): the original Spanning Tree Protocol
    • RSTP (802.1w): Rapid STP; significantly speeds up network convergence
    • PVST: Per-VLAN Spanning Tree; Cisco-proprietary; forms one spanning tree for each VLAN
    • Rapid PVST+: Cisco-proprietary; PVST that is faster.
    • MSTP (802.1q-2014): Multiple Spanning Tree Protocol; like PVST and RSTP, but creates groups of VLANs that share spanning trees (one per group of VLANs, rather than one per VLAN.)
    • Cisco defaults to PVST+ or Rapid PVST+ (depending on the type of switch)
  • Arista defaults to MSTP

Switches and Bridges

  • Spanning Tree often refers to switches as bridges
  • A bridge is just a switch with very few ports
  • When you see “bridge” in a modern networking context, just think “switch”

STP’s general mechanism

  • Switches regularly send BPDU (Bridge Protocol Data Unit) packets out of every port
  • BPDU contains unique identifier of the Switch
  • BPDU also contains a “path cost” field. Cost depends on the speed of the interface.
  • BPDU contains a “bridge priority” field too. Lowest bridge priority wins.
  • BPDUs received from other switches are forwarded out of every port except the port it was received on
  • the Path Cost in the received BPDU is increased before it’s forwarded
  • if a switch receives its own BPDU:
    • it knows there must be a loop
    • it does not forward the BPDU

Root Bridge

A simple layer 2 topology showing the root bridge.

A simple topology

STP Root Bridge Election

  • the Spanning Tree root bridge is elected based on the bridge priority field in the received BPDUs
    • the Root Priority is configured manually!
  • lowest bridge priority becomes the root bridge
  • now, the job of every switch is to find the cheapest path to the root

Root Path Selection

  • a given switch may have received multiple BPDUs from the root bridge
    • (one per path!)
  • if there are multiple paths to the root bridge, one must be chosen
    • there can be only one
  • the path with the cheapest cost is chosen
    • this interface is called the ROOT port
  • the other paths are blocked
    • these interfaces are labelled as ALTERNATE

Port types

STP might decide that these are the port states:

Topology with STP port states


A lab with experiments!