Spanning TreeCCNA 200-301

STP Port Cost Change Not Influencing Path Selection

Presenting Symptom

After increasing the port cost on a redundant link, the STP root port selection does not change as expected, and traffic continues to use the higher-cost path.

Network Context

A small branch office network with two Cisco Catalyst 2960 switches (SW1 and SW2) running IOS 15.0. SW1 is the root bridge. Two redundant trunk links connect the switches: Gi0/1 (1 Gbps) and Gi0/2 (1 Gbps). The network engineer increased the port cost on SW2's Gi0/2 to influence root port selection, but the root port remains on Gi0/2.

Diagnostic Steps

1

Check STP status on SW2

show spanning-tree vlan 1
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0011.2233.4455
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0011.2233.4466
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi0/1            Desg FWD 4         128.1    P2p
Gi0/2            Root FWD 4         128.2    P2p

The output shows that Gi0/2 is the root port with cost 4, even though you expected Gi0/1 to become root port after increasing cost on Gi0/2. Note that both ports show cost 4, indicating the cost change may not have been applied correctly.

2

Verify the port cost configuration on SW2 Gi0/2

show running-config interface gigabitethernet0/2
interface GigabitEthernet0/2
 switchport mode trunk
 spanning-tree cost 19
!

The output shows that the spanning-tree cost is set to 19 on Gi0/2. However, the 'show spanning-tree' output still shows cost 4. This discrepancy suggests that the cost command might be overridden or not taking effect due to a configuration issue.

3

Check if port cost is being overridden by path cost method

show spanning-tree vlan 1 interface gigabitethernet0/2 detail
Port 2 (GigabitEthernet0/2) of VLAN0001 is root forwarding
   Port path cost 4, Port priority 128, Port identifier 128.2.
   Designated root has priority 32769, address 0011.2233.4455
   Designated bridge has priority 32769, address 0011.2233.4455
   Designated port id is 128.2, designated path cost 0
   Timers: message age 2, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   Link type is point-to-point by default
   BPDU: sent 3, received 3
   The port is not in the portfast mode

The detail output confirms the port path cost is 4, not 19. This indicates that the configured cost is not being applied. Possible reasons: the cost command is under the wrong interface, or the switch is using a different spanning-tree mode (e.g., MST) where cost is configured per instance.

4

Check the spanning-tree mode and verify if cost is applied per VLAN

show spanning-tree summary
Switch is in pvst mode
Root bridge for: none
EtherChannel misconfiguration guard
UplinkFast is disabled
BackboneFast is disabled

Name                 Blocking Listening Learning Forwarding STP Active
------------------- -------- --------- -------- ---------- ----------
VLAN0001                   0         0        0          2          2
------------------- -------- --------- -------- ---------- ----------

The switch is in PVST mode. In PVST, the 'spanning-tree cost' command should apply per interface. However, if the cost was configured under a different VLAN or interface, it might not affect VLAN 1. Also, check if the cost was applied to the wrong interface (e.g., Gi0/1 instead of Gi0/2).

Root Cause

The spanning-tree cost was configured on the wrong interface. The engineer intended to increase the cost on Gi0/2 to make Gi0/1 the root port, but the cost was applied to Gi0/1 instead, leaving Gi0/2 with default cost 4. Alternatively, the cost was applied to the correct interface but under a different VLAN (e.g., VLAN 10) while the STP instance for VLAN 1 remained unchanged.

Resolution

Remove the incorrect cost configuration and apply the correct cost on the intended interface. On SW2: ``` interface GigabitEthernet0/1 no spanning-tree cost 19 ! interface GigabitEthernet0/2 spanning-tree cost 19 ``` This sets the cost of Gi0/2 to 19, making Gi0/1 (cost 4) the preferred root port.

Verification

Run 'show spanning-tree vlan 1' on SW2 to confirm the root port has changed. Expected output: ``` VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address 0011.2233.4455 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 0011.2233.4466 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 sec Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Gi0/1 Root FWD 4 128.1 P2p Gi0/2 Altn BLK 19 128.2 P2p ``` Now Gi0/1 is the root port (cost 4) and Gi0/2 is alternate (blocking) with cost 19.

Prevention

1. Always verify the interface on which you are configuring STP cost using 'show running-config interface' before applying changes. 2. Use 'show spanning-tree' to confirm the cost change took effect immediately. 3. Document the desired STP topology and verify root port selection after changes.

CCNA Exam Relevance

On the CCNA 200-301 exam, this scenario tests your ability to troubleshoot STP path selection. Expect a multiple-choice question where you must identify why a port cost change did not influence the root port. The exam tests understanding of 'spanning-tree cost' command application and verification with 'show spanning-tree'. Key fact: The cost must be configured on the non-root bridge's interface that faces the root bridge to influence root port selection.

Exam Tips

1.

Remember that STP cost is configured on the non-root bridge, not the root bridge.

2.

Use 'show spanning-tree' to verify the actual cost and role; don't rely solely on running-config.

3.

Be aware that in PVST, cost is per-VLAN; ensure you are checking the correct VLAN.

Commands Used in This Scenario

Test Your CCNA Knowledge

Practice with scenario-based questions to prepare for the CCNA 200-301 exam.

Practice CCNA Questions