Refer to Figure Spanning Tree Topology. All switches are configured for STP compatible using spanning-tree compatibility stp in Global Configuration mode. 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 it is in discarding state.
When a loop occurs in the network topology, spanning tree protocol may use path cost to determine the spanning tree states of the ports. Path cost is obtained from the speed of the interface. A user can configure lower path cost for an interface, if the port needs to be selected first or the user can configure higher path cost if the port needs to be selected last for putting it to 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 lowest numbered port is first put into forwarding state by spanning tree.
Type the following:
iS5comm# configure terminal
iS5comm(config)# interface gigabitethernet 0/1
Valid interfaces include physical interfaces and port-channel logical interfaces (port-channel port-channel-number).
iS5comm(config-if)# spanning-tree cost 2000
Observation after configuring the Path Cost for port 1 in Switch C: Port 2 of Switch B is the Alternate Port and Port 2 of Switch C is a Designated Port.
iS5comm(config)#end
iS5comm# show spanning-tree
In Switch A
Root Id Priority 32768
Address 00:01:02:03:04:01
Cost 200000
Port 0 [0]
Max age 20 sec 0 cs, forward delay 15 sec 0 cs
Hello Time 2 sec 0 cs
MST00
Spanning Tree Protocol Enabled.
MST000 is executing the mstp compatible Multiple Spanning Tree Protocol
Bridge Id Priority 32768
Address 00:01:02:03:04:01
Max age is 20 sec 0 cs, forward delay is 15 sec 0 cs
Hello Time is 2 sec 0 cs
Name Role State Cost Prio Type
---- ---- ----- ---- ---- ------
Gi0/1 Designated Forwarding 200000 128 SharedLan
Gi0/2 Designated Forwarding 200000 128 SharedLan
In Switch B
Root Id Priority 4096
Address 00:03:02:03:04:01
Cost 200000
Port 1 [Gi0/1]
Max age 20 sec 0 cs, forward delay 15 sec 0 cs
Hello Time 2 sec 0 cs
MST00
Spanning Tree Protocol Enabled.
MST000 is executing the mstp compatible Multiple Spanning Tree Protocol
Bridge Id Priority 32768
Address 00:02:02:03:04:01
Max age is 20 sec 0 cs, forward delay is 15 sec 0 cs
Hello Time is 2 sec 0 cs
Name Role State Cost Prio Type
---- ---- ----- ---- ---- ------
Gi0/1 Root Forwarding 200000 128 SharedLan
Gi0/2 Alternate Forwarding 200000 128 SharedLan
In Switch C
Root Id Priority 32768
Address 00:03:02:03:04:01
Cost 2000
Port 1 [Gi0/1]
Max age 20 sec 0 cs, forward delay 15 sec 0 cs
Hello Time 2 sec 0 cs
MST00
Spanning Tree Protocol Enabled.
MST000 is executing the mstp compatible Multiple Spanning Tree Protocol
Bridge Id Priority 4096
Address 00:03:02:03:04:01
Max age is 20 sec 0 cs, forward delay is 15 sec 0 cs
Hello Time is 2 sec 0 cs
Name Role State Cost Prio Type
---- ---- ----- ---- ---- ------
Gi0/1 Root Forwarding 200000 128 SharedLan
Gi0/2 Designated Forwarding 200000 128 SharedLan
iS5comm(config-if)#no spanning-tree cost