When a loop occurs in the network topology, STP path cost can be used to determine the spanning-tree states of the ports. Path cost is obtained from the speed of the interface. A user configures lower path cost for an interface if the port needs to be selected first, or the user configures higher path cost if the port needs to be selected last for putting it into forwarding state.
Path cost is used to determine the topology only if the loop in the network cannot be resolved using only the Bridge IDs. If all ports have same path cost values, then the spanning tree first puts the lowest numbered port into forwarding state.
Refer to Figure Spanning Tree Topology for topology. After the topology stabilizes and switch A is elected as Root, the ports of all switches, except Port 2 of switch C, are in forwarding state. Port 2 of Switch C is an alternate port and is in discarding state.
This example configures the path cost associated with port 0/1 to 2000.