STP, RSTP, MST, PVST all share one common thing which is almost
never discusses and rarely documented. The priority value in the BID.
MST - Multiple spanning-tree.
I had to dig to find stuff on this, there isn't a lot of
documentation around for MST. A good video that explains the basics can be
found here: http://youtu.be/U2CNahYexlg
Cisco's documentation: http://www.cisco.com/en/US/tech/tk389/tk621/technologies_white_paper09186a0080094cfc.shtml#diag2
I'm just off to configure this on my rack and see how things
go.
But back the main topic, STP's BID.
Okay so we know the BID of a switch is the combination of the
priority value and the mac address. A normal BID usually looks like this:
The zero is the vlan number, aka system-extended-id used in pvst
and rapid-pvst
We’ll come back to that shortly.
We also know how this combination works to determine the root STP
bridge:
- Lowest priority wins
- If priorities are equal then lowest MAC addy wins
But where did this default priority come from? And why does it
have to be 32768? A bit weird isn’t it? I didn’t pay much attention to it
before, I accepted it for what it was, accepted that it must be for some reason
but didn’t care too much. But it really annoyed me when I started tweaking PVST
to do load balancing.
In the below figure the following lines were entered on switch A
and switch B
Switch-A (config) # spanning-tree vlan 20 root primary
Switch-B (config) # spanning-tree vlan 20 root secondary
Switch-B (config) # spanning-tree vlan 10 root primary
Switch-B (config) # spanning-tree vlan 10 root secondary
Load balancing done for vlan 10 and 20 – beautiful
But as I said before, the priority value is so strange, why the
random number, or is it not random?
After some reading I learned back in the old days before PVST the
priority value was a flat decimal of 65536, the standard 16 bit number that’s applied
to almost everything networking related
PVST uses 12 bits for the system-extended-id leaving 4 bits for
the priority value, why?
Well that’s how PVST’s automation works, you see, by stealing 12
bits from the 16 bit value of 65536 we’re able to assign 4096 vlans per
priority group… AHHHH so now you see why the maximum vlan range is 4096. Now if
you’re wondering what I mean by priority group, I mean the remaining 4 bits.
Confused? Lol
Okay first jump on a switch and enter this:
Switch (config) # spanning-tree vlan 1 priority ?
The output shows you can only go up in increments of 4096
4096
8192
16384
32768
Notice that’s 4 numbers,
Notice the lower number is the usual 4096 seen in vlan
configurations
Notice the 32768 is the default priority value for spanning-tree
So it’s not random eh?
This means, as per our diagram, the manual setting of root primary
and root secondary respectively which results in 28672 and 24576 must be a calculation
of 4096 and yes it is.
They both sit at the power of 7 and the power of 6 respectively
32768 = 8
squared
28673 = 7
squared
24576 = 6
squared
And so on ….
So if you look at it,
The default is 8, setting the root manually drops one increment of
4096, and setting the secondary drops another increment.
Now this explains the randomness, which I guess isn’t random
Side note: if you did your calculations you’d realize the maximum
increment is 15 which means you can only set 15 manual spanning-tree bridges in
your switch broadcast domain via the priority value.
I suppose you could change MAC addresses, but that’s a bit extreme
for STP I would think… what are the chances of 15 bridges failing, and even
then if 15 bridges fail I’m sure you wouldn’t give a rats ass about vlan
traffic flow, at that point.
Any questions are welcomed
Cheers