To understand how Spanning Tree Protocol (STP) selects the Root Bridge, you first need to understand the concept of the Bridge ID, often called the BID.
The Bridge ID uniquely identifies a switch in an STP topology. It is built from two elements. The first is the extended priority, which is a configurable numeric value.
By default, the priority is set to 32,768. This value is combined with the VLAN ID. For example, on VLAN 1, the calculation becomes 32,768 plus 1, resulting in 32,769.
The second element is the MAC address. This part is used only when multiple switches share the same priority, acting as a tiebreaker.
When these two elements are combined, they form the complete Bridge ID. A typical example looks like this: 32,769 followed by the MAC address AABB.CCDD.EE01.
Root Bridge Election Process
During the Root Bridge election, switches exchange BPDUs, which are Bridge Protocol Data Units. These messages allow each switch to advertise its Bridge ID and learn the Bridge IDs of other devices in the topology.
STP always elects the switch with the lowest Bridge ID as the Root Bridge. The comparison starts with the priority value. If priorities are equal, STP then compares MAC addresses. In that case, the switch with the lowest MAC address is elected.
For example, if three switches use the default priority on VLAN 1, their Bridge IDs might all start with 32,769 but end with different MAC addresses. If SW1 ends in EE01, SW2 in EE02, and SW3 in EE03, SW1 becomes the Root Bridge because its MAC address is the lowest.
The election logic is straightforward. A lower priority increases the chances of becoming the Root Bridge. When priorities are equal, the lowest MAC address wins. In all cases, the Root Bridge is always the device with the lowest Bridge ID in the network.
For more information and a complete explanation of how Spanning Tree Protocol works, including port roles, states, and loop prevention, see this detailed CCNA guide: https://pingmynetwork.com/network/ccna-200-301/how-spanning-tree-protocol-works

Top comments (1)
Great illustration!