Electing Root Ports
Now that a
reference point has been nominated and elected for the entire switched network,
each nonroot switch must figure out where it is in relation to the root bridge.
This action can be performed by selecting only one root port on each
nonroot switch. The root port always
points toward the current root bridge.
STP uses the
concept of cost to determine many things. Selecting a root port involves evaluating
the root path cost. This value is the cumulative cost of all
the links leading to the root bridge. A particular switch link also has a
cost associated with it, called the path
cost. To understand the difference between these values, remember that
only the root path cost is carried inside the BPDU. (Refer to Table 2.2.) As
the root path cost travels along, other switches can modify its value to make
it cumulative. The path cost, however, is not contained in the BPDU. It is
known only to the local switch where the port (or“path” to a neighboring
switch) resides.
Path costs are
defined as a 1-byte value, with the default values shown in Table 2.3. Generally,
the higher the bandwidth of a link, the lower the cost of transporting data across
it. The original IEEE 802.1D standard defined path cost as 1000 Mbps divided by
the link bandwidth in megabits per second. These values are shown in the center
column of the table. Modern networks commonly use Gigabit and 10-Gigabit
Ethernet, which are both either too close to or greater than the maximum scale
of 1000 Mbps. The IEEE now uses a nonlinear scale for path cost, as shown in
the right column of the table.
Table 6-3 STP Path Cost
Link
Bandwidth Old
STP Cost New STP Cost
4
Mbps 250
250
10
Mbps 100 100
16
Mbps 63 62
45
Mbps 22 39
100
Mbps 10 19
155
Mbps 6 14
622
Mbps 2 6
1
Gbps 1 4
10
Gbps 0 2
The root path cost value is determined in the following manner:
1.
The root bridge sends out a BPDU with a root path cost
value of 0 because its ports sit directly on the root bridge.
2.
When the next-closest neighbor receives the BPDU, it
adds the path cost of its own port where the BPDU arrived. (This is done as the
BPDU is received.)
3.
The neighbor sends out BPDUs with this new cumulative
value as the root path cost.
4.
The root path cost is incremented by the ingress port
path cost as the BPDU is received at each switch down the line.
5.
Notice the emphasis on incrementing the root path cost
as BPDUs are received. When computing the spanning-tree algorithm
manually, remember to compute a new root path cost as BPDUs come in to a
switch port, not as they go out.
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 path to the root
bridge must be better using this port than it was on other ports. The switch
has now determined which of its ports has the best path to the root: the root
port.
Figure 2.4 shows the same network from
Figure 2.3 in the process of root port selection.
Figure 2.4 Example of Root Port Selection
The
root bridge, Switch A, already has been elected. Therefore, every other switch
in the network must choose one port that has the best path to the root bridge.
Switch B selects its port gi1/0/1, with a root path cost of 0 plus 19. Port gi1/0/2
is not chosen because its root path cost is 0 (BPDU from Switch A) plus 19
(path cost of A–C link), plus 19 (path cost of C–B link), or a total of 38.
Switch C makes an identical choice of port gi1/0/1.