Root Ports Election
Once a reference point has been nominated and elected for the entire switched network, each non-root
switch must find its relation to the Root Bridge. This action can be performed by selecting only one Root
Port on each non-root switch. STP uses the Root Path Cost to select a Root Port. The Root Path Cost is the
cumulative cost of all the links leading to the Root Bridge. A particular switch link has a cost associated
with it called the Port or Path Cost. This cost is inversely proportional to the port's bandwidth. As the Path
Cost travels along, other switches can modify its value to make it cumulative. The Path Cost is known only
to the local switch where the port or "path" to a neighboring switch resides as it is not contained in the
BPDU. Only the Root Path Cost is contained in the BPDU. Path Costs are defined as a one-byte value.
The Root Bridge sends out a BPDU with a Root Path Cost value of zero because its ports sit directly on the
Root Bridge. When the next closest neighbor receives the BPDU, it adds the Path Cost of its own port where
the BPDU arrived. The neighbor then sends out BPDUs with this new cumulative value as the Root Path
Cost. This value is incremented by subsequent switch port Path Costs as the BPDU is received by each
switch on down the line. After incrementing the Root Path Cost, a switch also records the value in its
memory. When a BPDU is received on another port and the new Root Path Cost is lower than the previously
recorded value, this lower value becomes the new Root Path Cost. In addition, the lower cost tells the switch
that the Root Bridge must be closer to this port than it was on other ports. The switch has now determined
which of its ports is the closest to the root-the Root Port.
If desired, the cost of a port can be modified from the default value. However, changing one port's cost may
influence STP to choose that port as a Root Port. Therefore careful calculation is required to ensure that the
desired path will be elected. On a CLI-based switch, the port cost can be modified by using one of the
following commands:
Switch (enable) set spantree portcost module_number/port_number
cost
or
Switch (enable) set spantree portvlancost module_number/port_number
[ cost cost ] [ vlan_list ]
On an IOS-based switch, the port cost for individual VLANs can be modified by using the following
command:
Switch (config-if)# spanning-tree [ vlan vlan_list ]
cost cost