5.2 STP Processes
5.2.3 Electing root ports

At the conclusion of the root war, the switches move on to selecting root ports. The root port of a bridge is the port that is closest to the root bridge. Every non-root bridge must select one root port.

Again, bridges use the concept of cost to measure closeness. Specifically, bridges track what is referred to as root path cost, the cumulative cost of all links to the root bridge. The Figure illustrates how this value is calculated across multiple bridges and the resulting root port election process.

When Cat-A (the root bridge) sends out BPDUs, they contain a root path cost of 0 (Step 1). When Cat-B receives these BPDUs, it adds the path cost of Port 1/1 to the root path cost contained in the received BPDU. Assume the network is running Fast Ethernet. Cat-B receives a root path cost of 0 and adds in the Port 1/1 cost of 19 (Step 2). Cat-B then uses the value of 19 internally and sends BPDUs with a root path cost of 19 out Port 1/ 2 (Step 3).

When Cat-C receives these BPDUs from Cat-B (Step 4), it increases the root path cost to 38 (19 + 19). However, Cat-C is also receiving BPDUs from the root bridge on Port 1/ 1. These enter Cat-C Port-1/1 with a cost of 0, and Cat-C increases the cost to 19 internally (Step 5). Cat-C has a decision to make: it must select a single root port, the port that is closest to the root bridge. Cat-C sees a root path cost of 19 on Port 1/1 and 38 on Port 1/2. Therefore, Cat-C Port-1/1 becomes the root port (Step 6). Cat-C then begins advertising this root path cost of 19 to downstream switches (Step 7).

Although not detailed in the Figure, Cat-B goes through a similar set of calculations: Cat-B Port-1/1 can reach the root bridge at a cost of 19, whereas Cat-B Port-1/2 calculates a cost of 38. Therefore, Port-1/1 becomes the root port for Cat-B. Notice that costs are incremented as BPDUs are received on a port.

Remember that STP costs are incremented as BPDUs are received on a port, not as they are sent out a port. For example, BPDUs arrive on Cat-B Port-1/1 with a cost of 0 and get increased to 19 "inside" Cat-B.