STP uses cost and priority values to determine the best path to the Root Bridge. These values are then used in the election of the Root Port, which will be described in the following section. It is important to understand the calculation of the cost and priority values in order to understand how Spanning Tree selects one port over another, for example.
One of the key functions of the STA is to attempt to provide the shortest path to each switch in the network from the Root Bridge. Once selected, this path is then used to forward data, whilst redundant links are placed into a Blocking state. STA uses two values to determine which port will be placed into a Forwarding state (i.e., is the best path to the Root Bridge) and which port(s) will be placed into a Blocking state. These values are the port cost and the port priority. Both are described in the sections that follow.
Spanning Tree Port Cost
The 802.1D specification assigns 16-bit (short) default port cost values to each port that is based on the port’s bandwidth. Because administrators also have the capability to assign port cost values manually (between 1 and 65535), the 16-bit values are used only for ports that have not been specifically configured for port cost. Table 31.1 below lists the default values for each type of port when using the short method to calculate the port cost:
Table 31.1 – Default STP Port Cost Values
|
Bandwidth |
Default Port Cost |
|
4Mbps |
250 |
|
10Mbps |
100 |
|
16Mbps |
62 |
|
100Mbps |
19 |
|
1Gbps |
4 |
|
10Gbps |
2 |
In Cisco IOS Catalyst switches, default port cost values can be verified by issuing the show spanning-tree interface [name] command, as illustrated in the following output, which shows the default short port cost for a FastEthernet interface:
|
VTP-Server#show spanning-tree interface FastEthernet0/2 Vlan Role Sts Cost Prio.Nbr Type |
The following output shows the same for long port cost assignment:
|
VTP-Server#show spanning-tree interface FastEthernet0/2 Vlan Role Sts Cost Prio.Nbr Type |
It is important to remember that ports with lower (numerical) costs are more preferred; the lower the port cost, the higher the probability of that particular port being elected the Root Port. The port cost value is globally significant and affects the entire Spanning Tree network. This value is configured on all Non-Root Switches in the Spanning Tree domain.