Sub topic 2
BPDUs: how switches talk about the topology
This chapter assumes you know how switches learn MAC addresses and flood unknown frames, and that you can read a switch command line. It also assumes you have seen why redundant links cause loops. Here we look at the messages switches use to avoid them.
What a BPDU is
A Bridge Protocol Data Unit (BPDU) is the frame that spanning tree switches exchange to describe the topology. Switches do not forward BPDUs like normal traffic. Each switch reads a BPDU on a port, uses it to update its own view, and then sends its own BPDUs out of the ports where it is allowed to.
BPDUs go to the reserved multicast MAC address 01:80:C2:00:00:00. Standards-compliant switches always consume frames sent to this address instead of flooding them. This is why a BPDU only travels one hop at a time.
Two kinds of BPDU
- Configuration BPDU: Carries the information used to build the tree. The root bridge originates it, and other switches relay an updated copy.
- Topology Change Notification (TCN) BPDU: A small message in classic 802.1D. A switch sends it toward the root when its topology changes. Chapter 10 covers it.
What a configuration BPDU carries
| Field | Meaning |
|---|---|
| Root bridge ID | The switch the sender currently believes is the root |
| Root path cost | The sender's total cost to reach that root |
| Sender bridge ID | The switch that sent this BPDU |
| Port ID | The sender's port that transmitted it |
| Timers | Hello time, max age and forward delay, as set by the root |
The bridge ID and the cost are what later chapters use to elect a root and pick ports. For now, treat them as the two pieces of information being compared.
How BPDUs flow
When a switch first boots, it assumes it is the root. It sends BPDUs naming itself as root with a cost of 0. If it hears a BPDU with a better root bridge ID, it stops claiming to be root. It then relays that better information onward, adding the cost of the port the BPDU arrived on.
In 802.1D, only the root originates configuration BPDUs. Other switches relay them on their designated ports. The root sends one every hello time, which defaults to 2 seconds. A switch that stops hearing BPDUs on a port ages out the stored information after max age, which defaults to 20 seconds. It then starts recalculating.
Why this matters in practice
BPDUs are sent untagged on the native VLAN with IEEE 802.1D, and Cisco PVST+ also sends a per-VLAN copy. A port that receives a BPDU is therefore connected to another switch or bridge. Later chapters rely on this fact. PortFast and BPDU Guard on host ports, for example, assume that no BPDU should ever arrive there.
You can see BPDU activity on a Linux host with a capture filter for the STP destination address:
sudo tcpdump -i eth0 -e -nn ether dst 01:80:c2:00:00:00Exercise
A switch receives a configuration BPDU on a port. Name two pieces of information in it that the switch will compare against its own, and say why the switch does not flood the BPDU like ordinary multicast traffic.
Show answer
It compares the root bridge ID and the root path cost (the sender bridge ID and port ID are used for tie-breaking). The destination MAC address 01:80:C2:00:00:00 is reserved for spanning tree, so switches process the frame locally and do not forward it as normal traffic. They send their own BPDUs instead.