Eric Stewart: Running Off At The Mouth

CCNP Notes: Spanning Tree/Doing The (Binary) Math

by Eric Stewart on Jul.05, 2024, under Networking, Technology

This is just me taking notes in a random way for my attempts to regain my CCNP.

Rewording/reworking/changing the direction of thinking in order to remember key bits and solidify why things are the way they are for Spanning-Tree – namely in this article, why Priority is the way it is.

Bridge IDs are 8 bytes: a 2 byte priority (for theoretical values from 0 to 65535 – but some values will likely never be used) and the MAC address of the device.

Ignoring the “macros”, we can set the priority to a value that is a multiple of 4096.  There’s a key reason why, so follow along.

Look at the 16 bits in binary, with the default switch priority value, 32768:

1000 0000 0000 0000

And also look at 4096 in binary (with appropriate leading values):

0001 0000 0000 0000

It should become apparent that the multiples are in that first group of four – which tracks; 32768 is 4096*8 (which, if you ignore the trailing 12 bits, should make a little more sense; 1000 in binary is 8).

So the max value you could set (in some desperate bid to never become root) should be 15*4096 or 61440.  But that’s not the key thing I’m looking to point out to myself here, just trivia (which, let’s face it, that’s a majority of what I’m missing on the ENCOR exam).

So, what’s a good value to stick in that first 12 bits?

Well, isn’t 802.1Q VLAN tagging limited to 12 bits?

If you look at the output of key commands (“show spanning-tree vlan <VLANID>” is one of my favorites) you’ll see that info:

switch# show spanning-tree vlan 3302

VLAN3302
  Spanning tree enabled protocol rstp
  Root ID    Priority    23782
             Address     002a.6ab7.c541
             Cost        1
             Port        4172 (port-channel77)
             Hello Time  2  sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    31974  (priority 28672 sys-id-ext 3302)
             Address     002a.6ab7.c0c1
             Hello Time  2  sec  Max Age 20 sec  Forward Delay 15 sec

So for this switch it’s own bridge ID in binary should be:

0111 1100 1110 0110

That’s why the priority must be a multiple of 4096: 0-4095 (ignoring that the VLAN values of 0 and 4095 are reserved) fit in the 12 bits that need to be zeroed out of the configured portion of the Bridge Priority so that the VLAN ID can be stuck in as a part of the complete priority.

Side note: Why not set the one you want to be root to 0?

Answer: You will potentially make your life difficult if you ever run into a situation where you suddenly don’t want that switch to be root for some reason.

EDIT:

And go figure that later in the reading, when referring specifically to Cisco’s implementation, they break it down into bits:

First four: Bridge Priority

Next 12: VLAN ID

Next 48: MAC Address

Notable though that in all command output, the decimal values are only two bytes in size, not the full eight, and the MAC address of the local switch and root switch are listed as a separate value from the “priority”, at least on Cisco devices I’ve come across.  Brocade, IIRC, listed the entire thing in hex, so you’d see the two bytes in four characters followed by the hex of the MAC.  You learned pretty quickly if the priority on a Brocade started with 8, something wasn’t quite right somewhere along the line.

:, ,

Hi! Did you get all the way down here and not find an answer to your question? The two preferred options for contacting me are:
  • Twitter: Just start your Twitter message with @BotFodder and I'll respond to it when I see it.
  • Reply to the post: Register (if you haven't already) on the site, submit your question as a comment to the blog post, and I'll reply as a comment.

Leave a Reply

You must be logged in to post a comment.