networking, updated

Spanning Tree (STP / RSTP)

The Spanning Tree Protocol stops loops in switched networks by electing a root bridge and blocking redundant links. Rogue BPDUs can take over the topology.

OSI layer
2 Data link
Carried in
Ethernet 802.3 + LLC (DSAP/SSAP 0x42)
Identified by
Destination MAC 01:80:c2:00:00:00 (PVST+: 01:00:0c:cc:cc:cd)
Specs
IEEE 802.1D, IEEE 802.1w, IEEE 802.1s
Wireshark filter
stp
Encrypted
no

Packet structure

STP / RSTP configuration BPDU36 bytes

Select a field to see what it does.

IEEE 802.1D / 802.1w. 35 bytes (36 for RSTP), sent in an 802.3 frame with LLC header (DSAP/SSAP 0x42) to 01:80:c2:00:00:00. Times are in 1/256 seconds.

Switches exchange these Bridge Protocol Data Units (BPDUs) every hello time (2 s) on every port where STP runs. Topology Change Notifications are only 4 bytes (Protocol ID, Version, Type).

How it works

Redundant links between switches would make broadcasts circle forever (a broadcast storm). STP builds a loop-free tree:

  1. Elect the root bridge: lowest Bridge ID (priority, then MAC) wins. Leaving all priorities at 32768 means the oldest switch (lowest MAC) often becomes root.
  2. Each other switch picks its root port: the port with the lowest cost to the root.
  3. Each segment picks a designated port: the one closest to the root.
  4. All other ports block. They still listen to BPDUs and take over if a link fails.
VersionConvergenceNotes
STP (802.1D)30–50 sStates: blocking → listening → learning → forwarding
RSTP (802.1w)About 1 sProposal/agreement handshake, edge ports forward at once
MSTP (802.1s)Like RSTPSeveral VLANs per tree instance
PVST+ / Rapid PVST+Like STP / RSTPCisco, one tree per VLAN, own destination MAC

Edge ports (PortFast): ports to end devices skip the listening and learning states. They should never receive BPDUs.

In Wireshark

FilterShows
stpAll BPDUs
stp.flags.tc == 1Topology changes (MAC tables get flushed)
stp.root.prio < 32768Roots with a lowered priority
stp.root.hw != 00:11:22:33:44:55BPDUs naming another root than the expected one
stp.type == 0x80Topology Change Notifications (classic STP)

What normal looks like: one BPDU every 2 s per port from the same root ID, few topology changes. BPDUs arriving on a port that leads to a PC are not normal.

Security notes

References

§ home
~/knubertus/home/
1,1 Top