TechKnowSurge
Cisco CCNA 2.5 Cisco CCNA 1.13
VideoNetworkFree

BPDU Header

Bridge Protocol Data Units (BPDUs) are the frames Spanning Tree Protocol uses to exchange switching topology information between switches, carrying key fields such as root ID, root path cost, bridge ID, and port ID. This information drives the STP election process that determines which ports remain active and which are blocked to prevent switching loops.

Complete this video to capture a CTF flag worth 1 point.

About this video

Spanning Tree Protocol uses Bridge Protocol Data Units (BPDUs) as the communication mechanism between switches, sending these frames out across every active link so that each switch has the information necessary to run the spanning tree algorithm and determine which ports to block in order to eliminate switching loops. A BPDU is roughly 35 bytes and contains several fields including protocol ID, version, type, and flags in its first five bytes, along with timer values such as hello time, max age, and forward delay. The hello time controls how frequently BPDUs are transmitted, with a default interval of two seconds. The four fields most directly relevant to the STP election process are the root ID, root path cost, bridge ID, and port ID. When a switch initializes, it has no knowledge of the network topology and assumes it is the root bridge, so it populates the root ID field with its own bridge ID, which is a combination of a configurable priority value, the extended system ID derived from VLAN membership, and the switch MAC address. As BPDUs circulate, a switch that receives an advertisement for a bridge with a lower priority or lower MAC address updates its root ID to reflect that superior candidate. The root path cost is determined by taking the cost value in an incoming BPDU and adding the cost of the local interface through which that BPDU arrived, so a BPDU entering through a Fast Ethernet interface would accumulate a cost of 200,000 for that link segment. The bridge ID field in outgoing BPDUs always reflects the transmitting switch itself, giving receiving switches a consistent reference for which device they are directly connected to. The port ID field is the one value that changes on a per-interface basis, combining the interface priority, which defaults to 128, with the port number, so each link carries a unique port ID. Neighboring switches use this complete set of BPDU fields to make informed decisions about root port and designated port elections, completing the STP process that produces a loop-free Layer 2 topology.

What you'll learn

What's covered

Bridge Protocol Data Units (BPDUs)

Aligned to

Cisco CCNA
2.5 Interpret basic operations of Rapid PVST+ Spanning Tree Protocol
1.13 Describe switching concepts

Key terms

Spanning Tree Protocol
STP
A network protocol that prevents loops in Ethernet networks by creating a loop-free logical topology.
Bridge Protocol Data Unit
BPDU
A data message exchanged between switches running Spanning Tree Protocol to detect network loops and elect a root bridge. BPDUs contain the sending switch's BID and path cost information used to build the loop-free spanning tree.
Bridge
A network device that connects two or more network segments and filters traffic based on MAC addresses.
Media Access Control
MAC
A sublayer of the Data Link layer that controls how devices on a network gain access to a medium and transmit data.
Switch
A network device that connects devices within a LAN and forwards traffic based on MAC addresses.
Root Path Cost
The cumulative cost calculated by a switch to reach the root bridge, based on the speed of each link along the path.

Topics

Spanning Tree Protocol Bpdu Root Bridge Election Switching Loops Layer 2 Switching Networking

Transcript

Why Switches Need BPDUs

Spanning Tree Protocol needs a way to communicate amongst the different switches, and it does that through frames called bridge protocol data units, or BPDUs. So let's take an in-depth look into what bridge protocol data units are and what they do.

We already know what the process is, and that is to elect a root bridge, calculate root path costs, elect root ports, elect designated ports and elect alternate ports. We know the process now that Spanning Tree Protocol uses, that spanning tree algorithm, to determine how it's going to send traffic in the future. But what it needs to do to elect these different root bridges and root ports and all of that — what it needs is information. That information gets passed from switch to switch down each one of these links, and each link has its own bridge protocol data unit that it sends back and forth. So we have quite a bit of bridge protocol data units that are being sent back and forth.

What Is Inside a BPDU

The information packed into a bridge protocol data unit is about 35 bytes of information. Here I have listed out what pieces of information it looks for. First of all, you can see there's a protocol ID, there's a version ID, there's type information, there are some flags — that all happens within the first five bytes of this. The first five bytes are just some information; we're not going to get too crazy into that.

The last part of this we haven't talked about: message age, max age, hello time, delay. We haven't talked about those yet, but those are different settings there for STP. The hello time is set to how often these BPDUs are going to be sent across the link, and the default is two seconds. That's not what this two represents — this two represents that there's two bytes here. This bottom section here is the bytes for each one of these, so we're not going to pay attention to that right now.

The big focus that we have is going to be the root ID, the root path cost, the bridge ID and the port ID — all of the information that we've been using to go through that spanning tree algorithm process to determine what is going to be the ports that we shut off. Essentially that's what it boils down to: what ports are we going to shut off, so that way we don't get these switching loops.

The Root ID

We're going to take this from the perspective of switch 2 right here, and what it's going to be sending out each of the links — the bridge protocol data units that it'll be sending out each link.

Initially, when this starts, switch 2 isn't aware of what the actual root bridge is going to be. So what it does initially is it populates the root ID with its own bridge ID. The root ID would be the bridge ID of switch 2, until it learns of a better option that's out there. It will learn of a better option with time, as BPDUs get communicated back to it. Once that happens and this switch realises that there is a better root bridge out there, that there is a root bridge that has a lower priority or a lower MAC address to it, then it will adjust. It will now know that there is a different root bridge out there, and then it will change the root ID to be whatever it discovers is new.

Don't forget that the bridge ID is that priority plus the extended system ID, which we know of as VLANs. The priority is something that we set, so that way we can skew the results, change the results of which switch is going to be the root bridge. Then we have the MAC address, and that's for when things are set to default — then it can use the MAC address, and we know the MAC address is going to be unique.

Once it learns of what the actual root bridge is, then the bridge protocol data units that it sends out are going to represent that. So inside this root ID, what we could actually do is put in that priority, 4096, and then it's going to have that VLAN information in it, so we would have that VLAN information in it. Then we would have the MAC address — in this case it's CC CC CC. I'm not going to add it all in there, but you get the point. That is going to be the root ID that it sends out, as it sends it out each of those links.

I took the liberty of going ahead and filling in the ones and zeros that represent switch 1. So the bridge protocol data units that switch 2 now sends out will have the root ID of the root bridge, which is going to be switch 1. You can see 4096 is 0001. The extended system ID just represents the VLAN that it's a part of, and I just put the default VLAN in there. Then the MAC address, CCCC, is represented in these other ones and zeros that come across there. So that's going to be what's going to be sent out at this point in the bridge protocol data units.

The Root Path Cost

Next, what switch 2 needs to do is determine the cost of each of these paths. What it will do is take whatever the BPDUs coming into switch 2 are, and then it will add the cost of the interface. So the BPDU coming from switch 1 is going to have a zero path cost at that point in time, and as it comes into switch 2, it will then say that's coming into a fast ethernet, which is a hundred megabits per second. It's coming into 100 megabits per second, so I'm going to add a cost, and for this link it's going to be 200,000. So now the cost to get from switch 2 to the root bridge is going to be 200,000. Let me write that into here, and now that is going to be what's sent out in its bridge protocol data unit from then on out, until it learns of a lower cost. So 200,000 is going to be set in that root path cost.

The Bridge ID and the Port ID

That is the root path cost. The bridge ID is pretty straightforward and it doesn't change no matter what. From switch 2, the bridge ID that it is going to send out is all going to be what is associated with switch 2, so that way these devices know that they're connected directly to switch 2. So what's going to be put into here is, once again, the priority — 32768 — plus that extended system ID, plus the MAC address. That's going to be all included in there. I once again translated this, so now you can see it's into ones and zeros at that point.

The last thing that's going to be sent out is going to be changed depending on the interface it's getting sent out from. In this case right here, if it's on this link, it's going to be sent out with whatever priority is set on that interface. Let's say it's just the default, which is 128. So it's going to be the priority plus the port number, and somehow this gets translated into a port number — we're just going to say 47. What's being sent out on this next one is 48, so instead of 47 it will be 48. What's being sent out this one right here is going to be whatever the priority is plus 45, and whatever is sent out this last link is going to be 46. So that's what gets sent out, and that way when this other switch gets that information, then it can make a determination on what's going to be its root port. This information gets all sent out, and now other switches can make decisions on what's going to be the root port and what's going to be the designated port.

There you have it: those are the bridge protocol data units that are going to be sent out along each one of those interfaces. Some of those are going to remain the same no matter what, such as the bridge ID. Some of those are going to change, like the root ID and the root path cost, while others like the port ID will change for every single port that it's sending out on.

About TechKnowSurge

TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.

Explore free tools and programs →