STP Bridge ID Priority
TWX
Member Posts: 275 ■■■□□□□□□□
in CCNA & CCENT
The BID in spanning-tree is eight bytes long. It's confusing in-part because the first two bytes are normally discussed in decimal while the remaining six are the hexadecimal MAC address.
Spanning-tree uses increments of 4096 in a range of of zero to 65535 for the priority, which is a value of two bytes or sixteen bits, at the beginning of the Bridge-ID. This has been modified into a four-bit priority multiple of 4096, followed by the "system ID extension" of 12 bits.
this means that the bits for two-byte number, the bold-part is the part that can be changed via spanning-tree vlan X priority X is:
zero:
00000000 00000000
So, 4096 is:
00010000 00000000
and 8192 is:
00100000 00000000
32768 (default) is:
10000000 00000000
and 40960 is:
10100000 00000000
up through 61440:
11110000 00000000
as the highest possible number achievable only being able to manipulate those four most-significant digits of that sixteen bit number.
Now the System ID extension, the least-signficant 12 bits of the 16 bit number, refer to the VLAN.
00000000 00000000
So, for VLAN 1:
00000000 00000001
For VLAN 10:
00000000 00001010
For VLAN 255:
00000000 11111111
For VLAN 256:
00000001 00000000
For VLAN 2048:
00001000 00000000
For VLAN 4094 (top VLAN):
00001111 11111110
So, to combine them...
Priority 32678 (default) on VLAN 255:
10000000 11111111 = 33023 = 32768+255
idf3-sw2#sh spanning-tree | inc (Bridge ID)
Bridge ID Priority 33023 (priority 32768 sys-id-ext 255)
Priority 24576 (higher than default) on VLAN 1998:
01100111 11001110 = 26574 = 24576+1998
idf3-sw1#sh spanning-tree | inc (Bridge ID)
Bridge ID Priority 26574 (priority 24576 sys-id-ext 199
Priority 4096 (very high) on VLAN 4094:
00011111 1111110 = 8190 = 4096+4094
idf3-sw1#sh spanning-tree | inc (Bridge ID)
Bridge ID Priority 8190 (priority 4096 sys-id-ext 4094)
Now to really bake your noodle, priority zero on vlan 1:
00000000 0000001= 1 = 0+1
idf3-sw1(config)#spanning-tree vlan 1 priority 0
idf3-sw1(config)#end
idf3-sw1#sh spanning-tree | inc (Bridge ID)
Bridge ID Priority 1 (priority 0 sys-id-ext 1)
Obviously priority zero is the highest possible priority. I've seen L3 switches set that way to ensure that they are always the root bridge no matter what ancient switch with a low MAC or other pre-existing config is brought up on the network.
As for the binary, this is another example where knowing how the binary works is very handy, but doing the binary math is not an every-day component of the topic. The switch doesn't even show you the binary, it shows you the BID/Priority combined and the separated priority and system ID extension in parenthesis. But, understanding the binary makes it a lot easier to know why the increment is 4096.
Spanning-tree uses increments of 4096 in a range of of zero to 65535 for the priority, which is a value of two bytes or sixteen bits, at the beginning of the Bridge-ID. This has been modified into a four-bit priority multiple of 4096, followed by the "system ID extension" of 12 bits.
this means that the bits for two-byte number, the bold-part is the part that can be changed via spanning-tree vlan X priority X is:
zero:
00000000 00000000
So, 4096 is:
00010000 00000000
and 8192 is:
00100000 00000000
32768 (default) is:
10000000 00000000
and 40960 is:
10100000 00000000
up through 61440:
11110000 00000000
as the highest possible number achievable only being able to manipulate those four most-significant digits of that sixteen bit number.
Now the System ID extension, the least-signficant 12 bits of the 16 bit number, refer to the VLAN.
00000000 00000000
So, for VLAN 1:
00000000 00000001
For VLAN 10:
00000000 00001010
For VLAN 255:
00000000 11111111
For VLAN 256:
00000001 00000000
For VLAN 2048:
00001000 00000000
For VLAN 4094 (top VLAN):
00001111 11111110
So, to combine them...
Priority 32678 (default) on VLAN 255:
10000000 11111111 = 33023 = 32768+255
idf3-sw2#sh spanning-tree | inc (Bridge ID)
Bridge ID Priority 33023 (priority 32768 sys-id-ext 255)
Priority 24576 (higher than default) on VLAN 1998:
01100111 11001110 = 26574 = 24576+1998
idf3-sw1#sh spanning-tree | inc (Bridge ID)
Bridge ID Priority 26574 (priority 24576 sys-id-ext 199
Priority 4096 (very high) on VLAN 4094:
00011111 1111110 = 8190 = 4096+4094
idf3-sw1#sh spanning-tree | inc (Bridge ID)
Bridge ID Priority 8190 (priority 4096 sys-id-ext 4094)
Now to really bake your noodle, priority zero on vlan 1:
00000000 0000001= 1 = 0+1
idf3-sw1(config)#spanning-tree vlan 1 priority 0
idf3-sw1(config)#end
idf3-sw1#sh spanning-tree | inc (Bridge ID)
Bridge ID Priority 1 (priority 0 sys-id-ext 1)
Obviously priority zero is the highest possible priority. I've seen L3 switches set that way to ensure that they are always the root bridge no matter what ancient switch with a low MAC or other pre-existing config is brought up on the network.
As for the binary, this is another example where knowing how the binary works is very handy, but doing the binary math is not an every-day component of the topic. The switch doesn't even show you the binary, it shows you the BID/Priority combined and the separated priority and system ID extension in parenthesis. But, understanding the binary makes it a lot easier to know why the increment is 4096.