5.2 STP Processes
5.2.2 Root-bridge elections

The switches first need to elect a single root bridge by looking for the bridge with the lowest BID. This process of selecting the bridge with the lowest BID is often referred to as a root war.

As discussed in the "Bridge ID" section earlier, a BID is an 8-byte identifier that is composed of two subfields: the bridge priority and a MAC address from the supervisor or backplane. In Figure , you can see that Cat-A has a default BID of 32,768.AA-AA-AA-AA-AA-AA. Note the mixing of a decimal bridge priority with a hexadecimal MAC address. Although this might look a little strange, this convention enables you to view each section of the BID in its most common format.

Continuing with the example, Cat-B assumes a default BID of 32,768.BB-BB-BB-BB-BB-BB, and Cat-C uses 32,768.CC-CC-CC-CC-CC-CC. Because all three bridges are using the default bridge priority of 32,768, the lowest MAC address (AA-AA-AA-AA-AA-AA) serves as the tie-breaker, and Cat-A becomes the root bridge. Figure illustrates this process.

The bridges learn that a Cat-A has the lowest BID through the exchange of BPDUs.  As discussed earlier, BPDUs are special packets that bridges use to exchange topology and Spanning-Tree information with each other. By default, BPDUs are sent out every 2 seconds. BPDUs are switch-to-switch traffic; they do not carry end-user traffic. Figure illustrates the basic layout of a BPDU.

For the purposes of the root war, the discussion is concerned only with the Root BID and Sender BID fields (again, the real names come later). When a bridge generates a BPDU (every 2 seconds), it places who it thinks is the root bridge at that instant in time in the Root BID field. The bridge always places its own BID in the Sender BID field.

A switch usually starts out assuming that the world revolves around itself. In other words, when a switch first boots, it always places its BID in both the Root BID and the Sender BID fields. Suppose that Cat-B boots first and starts sending out BPDUs announcing itself as the root bridge every 2 seconds. A few minutes later, Cat-C boots and boldly announces itself as the root bridge. When the Cat-C BPDU arrives at Cat-B, Cat-B discards the BPDU because it has a lower BID saved on its ports (its own BID). As soon as Cat-B transmits a BPDU, Cat-C learns that it is not quite as important as it initially assumed. At this point, Cat-C starts sending BPDUs that list Cat-B as the root BID and Cat-C as the sender BID. The network now agrees that Cat-B is the root bridge.

Five minutes later Cat-A boots. As with Cat-B earlier, Cat-A initially assumes that it is the root bridge and starts advertising this fact in BPDUs. As soon as these BPDUs arrive at Cat-B and Cat-C, these switches hand over the root bridge position to Cat-A. All three switches are now sending out BPDUs that announce Cat-A as the root bridge and themselves as the sender BID.