This topic is to discuss the following lesson:
may i know what u have updated in this lesson compared to previous article ??
Hi everyone
what tips or practices do you use to search for root bridges quickly
in a network with 290 switches
thank you
Hello Giovanni
In order to find the root bridge, you can issue the show spanning-tree
command, and this will show you the root bridge for each VLAN configured on the switch. You’ll get something like this:
SW2#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 5254.001a.935a
Cost 4
Port 1 (GigabitEthernet0/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28682 (priority 28672 sys-id-ext 10)
Address 5254.0015.bc74
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0 Root FWD 4 128.1 P2p
Gi0/1 Desg FWD 4 128.2 P2p
From the above output, you can see that for VLAN 10, the root bridge has an address of 5254.001a.935a. You also know which is the root port.
Now if you know nothing else about your network of 290 switches, it may be hard to find that particular switch. What you can do is take a look at the cost to the root bridge, and this will give you an idea of how far away it is. In this case, the cost is 4. For more info on how to interpret these costs, take a look at the NetworkLessons note on STP cost calculation methods.
Once you know the cost and the root port from the output, you can determine how far away the root bridge is, and via what path you can get there. You can trace your way back, from switch to switch, until you reach it. If you have no other information, that would be the way to find the root bridge.
Now having said that, even if you have 290 switches it is unlikely that the root bridge for any particular VLAN would be very far away from any switch. An STP tree should never be more than six or seven switches in diameter, and a network of 290 switches should be subdivided into several network segments anyway. A purely Layer 2 network of so many switches would not be functional.
But in most networks of that size, you would have some sort of monitoring system, so if you learn the MAC address of the root bridge, you can then search for it easily within that monitoring system. And in most such networks, you would manually configure the switches in such a way so that a specific device would become the root bridge, thus any (responsible) administrator should know which switch that is…
I hope this has been helpful!
Laz
Question about the BID.
What is the purpose to add the vlan id to the priority ?
Hello Michael
The valid values for bridge priorities in STP are between 0 and 61440. Hpwever, the value must be in increments of 4096. So in practice, the valid values for bridge priorities are: 0, 4096, 8192, 12288, …, up to 61440.
Have you ever wondered why they’re in increments of 4096? It’s not a coincidence that the VLAN ID is a 12-bit value, which can represent up to 4096 VLAN IDs. The reason is because for every VLAN you have a different priority.
In the original 802.1D standard for Spanning Tree Protocol, the 2-byte (16-bit) Priority field in the BPDU is actually divided into two parts: the most significant 4 bits are for the Priority, and the least significant 12 bits are for the VLAN ID. This scheme is used in a variant of STP known as Per-VLAN Spanning Tree Plus (PVST+), which is common on Cisco devices.
This means that the Bridge Priority is effectively a 4-bit value, but it’s still stored in a 16-bit field along with the VLAN ID. Because of this, it can only be incremented in steps of 2^12 (4096), which corresponds to shifting the bits over by 12 places. This is why the valid priorities are multiples of 4096.
So a bridge with a set priority of 12288 that is using VLAN 7 will actually have a priority value in the BPDU field of 12288+7 = 12295. That priority value is unique to VLAN 7 because you can have a root bridge for each individual VLAN, and the priorities must be unique. Does that make sense?
I hope this has been helpful!
Laz
Hello, everyone.
I have a question about the spanning-tree vlan x root primary
command.
A lot of resources say that if default priorities aren’t being used, the switch where this command was issued will use a priority that is lower by 4096 than the root bridge’s priority.
However, in my Cisco CML lab, I’ve encountered something I didn’t expect.
Consider this example
ROOT BRIDGE - 24576:0000:0000:0002
Another switch - 32768:0000:0000:0001
If I issue the root primary command on the second switch, it doesn’t change it’s priority to be lower by 4096 than the root bridge’s priority.
What it does is pick the exact same priority as it and rely on the MAC to make it the root bridge since it’s lower. So the result looks something like this:
ROOT BRIDGE - 24576:0000:0000:0001
Another switch - 24576:0000:0000:0002
Now, if I issue the root primary command on the switch that was previously the root bridge, it will lower its priority by 4096 since its MAC is higher than the current root bridge’s.
ROOT BRIDGE - 20480:0000:0000:0002
Another switch - 24576:0000:0000:0001
Is all of this correct? I wasn’t quite expecting this to happen at first.
Thank you.
David
Hello David
This is an interesting one because this command operates somewhat differently than more conventional IOS commands. First of all, keep in mind that this command runs a hardwired script in the background that performs specific functions. After doing a bit of research, it seems that this command functions slightly differently depending on the IOS version and platform.
Some documentation for the 15.2(2)E IOS version for example, states that:
Because of the extended system ID support, the switch sets the switch priority for the specified VLAN to 24576 if this value will cause this switch to become the root for the specified VLAN. If any root switch for the specified VLAN has a switch priority lower than 24576, the switch sets its own priority for the specified VLAN to 4096 less than the lowest switch priority.
Other documentation for IOS 12.4 states that:
The spanning-tree root primary
command alters this switch’s bridge priority to 8192. If you enter the spanning-tree root primary
command and the switch does not become the root switch, then the bridge priority is changed to 100 less than the bridge priority of the current bridge. If the switch still does not become the root, an error results.
Still other documentation states that:
The primary keyword sets the priority to 24,576, and the secondary keyword sets the priority to 28,672.
There may be other slightly different behaviors as well. The point here is that this command will run a script that will examine the current root bridge, and will attempt to change the priority values of the local switch so that it becomes the root bridge. The script will examine the current situation and choose a priority value that makes the local switch the root, just like it did in the experiment that you shared in your post.
The other thing you must keep in mind is that since this command is a script, it will be run at the moment you put in the command, and the resulting priority value will be used. This value will not change unless the script is run again. If the root priorities of other switches on the topology change, and cause another switch to become the root, the script does not rerun to make the local switch root again. In other words, the command is not preemptive.
So the behavior you are seeing is correct, since it caused the local switch to become (or remain) the root bridge.
I hope this has been helpful!
Laz