The Spanning Tree Protocol root bridge election process determines how switches establish a network reference point by selecting the device with the lowest bridge ID, a value composed of priority, extended system ID, and MAC address. Understanding how these components interact — and how to manually influence the election — is essential for controlling traffic flow in switched networks.
Root Bridge Election
For the spanning tree algorithm to work correctly, it needs a reference point. That's what the root bridge is: it's a reference point for the whole network, so the rest of the network knows how to forward the traffic and base its decisions off of this reference point.
The first step in this is to elect a root bridge. The root bridge is going to be the bridge with the lowest bridge ID. So then that asks the question: what is a bridge ID?
The bridge ID is eight bytes long and made up of three different components. Those components are the priority, the extended system ID and the MAC address. We can see that the MAC address makes up the majority of this. It makes up six of the eight bytes — you can count them, one, two, three, four, five, six, seven, eight — so the MAC address is six of those eight bytes.
But when it comes to bridge ID, the most significant values are here to the left side of it. And remember, when I'm talking about this, whatever is the lowest bridge ID within the network becomes the root bridge. So when I say that the most significant bits are over here on the left hand side, it's going to be the same thing as if I'm comparing 200 to 300. What is the bigger number? We see that the bigger number is this 300, and that's because the 3 is larger than the 2, that is the most significant bit. So the most significant bits of this bridge ID are sitting here all the way to the left hand side, which is our priority right there.
So if we want a specific bridge ID to become the root bridge, we set a lower number on that bridge for bridge priority.
Now bridge priority is a little interesting. First of all, we do have a choice between zero and 61,440, so it's quite a range right there. That's because when we're setting this, it's for these 16 bits right there, and 16 bits gives us that big huge range right there. That's essentially what it does.
But another interesting thing is, because it's on the last four bits that we set right there, it actually increments in 4096. That's because this is the 4096 place right here for the bits. If we were to break this down into the bits and we did the 2, 4, 8, 16 and did all of that, then it increments up by 4096. Now, don't get lost in that, that's not the important part. It just increments by 40096, just realize that part of it.
So the priority, what we're going to set, is we're going to set it anywhere from zero to 61,440, increments by 4096, and the default for it is going to be 32,768. So by default, all of the bridges have that set.
Now, one of the reasons why we get the MAC address in there is because, since there is a default, there's a good chance that a lot of these switches have the same priority level, because there's the default of 32,768. So what it needs is a tie breaker, and we know that the MAC address is unique. So by adding the MAC address to the priority, it says, well, there's a good chance that a lot of these priorities are going to be the same, so if that's the case then we'll default to the MAC address and just take a look at the MAC address.
So that's how it makes sure that there can be one and only one root bridge that's elected, and that all devices on the network know how to select it, because it's based off of the bridge ID. It looks first of all for this priority and says, what is the priority, and we're going to base our election off of the priority. But if they're all the same, then let's just go ahead and take a look at the MAC address instead, because that is the last part of this component of the bridge ID.
Now let's talk about the system ID here just really quickly, and that is the system ID, so we can do this per VLAN. If we want to specify a different priority for every single VLAN, which we may want to do to split up some of this traffic, then we can actually set the priority by VLAN, and that's where the extended system ID then gets set in there. It is to identify each of the VLANs and a separate priority for each one of those VLANs.
So for the most part, when we're talking about STP, we're going to probably ignore the extended system ID for now and not really get into the difference of that. For now, let's focus on this priority and setting priorities on the switch.
So let's look at this in application. We know that by default the priority of these switches are set to 32, and so if all three of these switches are set to the same priority, then what's going to happen is it's going to go through this process and elect the one with the lowest MAC address. When we look at the lowest MAC address, A actually is lower than B or C, and so what it will do is elect this bridge right here as being the root bridge.
Now that means that all traffic is going to prefer to go through the root bridge, which is not necessarily what we want. For some of it, it's not going to be that big of a deal, but for others — like for this switch, switch number two, to get out to the outside world — it's not going to take the fastest route. It's going to actually go and send traffic through the root bridge and then out, so it's going to take the wrong path out.
So what we want to do in this case is actually set a priority that will force one of these switches to become the primary root bridge. In this case right here, what we're going to do is we want the root bridge to be this one right here, so we would go on to that switch and set it for a priority. We know that the priority increments up by 4096, so I'm going to just choose it as being the first option, 4096. I'm going to set that priority on this root bridge, and now it will make sure that that root bridge is elected to be the root bridge, and then all other devices will plan on sending its traffic towards that root bridge, or at least turning on the ports.
Here's the time to actually apply what you learned. This is the question: which is the root bridge? Take a look at this setup right here, these different switches right here, and determine which would be the root bridge on this network.
If you chose that this switch right here is the root bridge, you would be right. So let's look at what plays into this. First of all, what we do is take a look at the priorities of the switches, and this is 496, 4096, 32,768. So it's looking for the lower ones, so these two are the same, but they are lower than this one, so that means that it's got to be either switch 2 or switch one here.
So next, what it has to do is it looks at the MAC address, and when it looks at the MAC address here, B is lower than C, so what it will choose is this B here as being the root bridge. So that's the answer.
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 →