STP - bridge priority
In an Spanning Tree Protocol (STP) environment, in order to avoid creating Layer 2 loops, a root bridge election process takes place to determine which switch will play the role of the root bridge. The root bridge selection depends upon the priority of each individual switch.
This priority value is a configurable value on a switch. The valid values for bridge priorities in STP are between 0 and 61440. However, the value must be in increments of 4096. So in practice, the valid values for bridge priorities are:
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.
Each switch participates in STP on a per-VLAN basis. So it must have a unique priority assigned to itself for each of its VLANs.
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?