Spanning Tree and Switches are a lot like the Highlander – “there can be only one” (root bridge in your spanning tree). The process of electing a root bridge is very similar to Highlander in that switches will battle it out until one bridge is the root. And all designated ports shall forward to it!
How the a root bridge is selected
The switch (or bridge) at the root of your spannning tree is also known as the root bridge. It is the switch or bridge with the lowest bridge ID. The bridge id is the combination of a unique ID as well as a priority number. When an election occurs, two bridge IDs are compared, the priority is compared first. If two bridges have equal priority, then the MAC addresses are compared. Again they are looking for the lowest number.
Manually Influencing the root bridge election
If you as the network engineer want a specific switch to be the root bridge (and you should have this in mind for your layer 2 network), you need to manually set the switch priority. For example, if you want switch A to be the root bridge, you must manually set the priority. This must be done for each vlan.
Here an example how to set the priority for the root bridge
switch>#spanning-tree vlan 1 root primary
A quicker way to set for a range of vlans would be:
switch>#spanning-tree vlan 1-100 root primary
Pretty simple huh? So now that you’ve set the root bridge, you may also want to designate a back up switch in case the root bridge succumbs to a hardware failure. So which switch should take over as Highlander (errr, umm root bridge) when the current one dies?
Setting up a secondary or backup root bridge is just as easy as setting up for the primary. To set a backup or secondary root bridge use the keyword – secondary:
switch>#spanning-tree vlan 1 root secondary
Why do I need to set the root bridge?
So through all of this you may be wondering, “Whats the big deal? Why do I need a root bridge or why do I need to set the root bridge?”
All layer two networks should logically look like an inverted tree with the largest most power switch as the root. This root bridge should also be at the core of your network. Without manually specifying a root bridge you could inadvertently have a small under-powered switch in a remote part of your network become the root bridge. A certain type of packet called a Bridge Protocol Data Unit (or BPDU) flow through you network ensuring that, from a layer 2 perspective the network is loop-free and forwarding traffic. Network traffic could easily over-whelm a small switch, loops could occur, and your users would constantly complain about slow network performance.
Setting your root bridge is a quick and easy configuration to make and will ensure that your layer 2 network is performing well and traffic is flowing the way you intend it to.
One comment
To the original poster. Awesome post! Actually provided good material that was easy to grasp and very cool way of explaining it. I myself am a huge Highlander fan, so I may be a little biased here! Any way, just know that someone really appreciated that post and it made me laugh!!!