spanning-tree pathcost method long
Configures the path cost calculation method for Spanning Tree Protocol (STP) to use 32-bit values (long) instead of the default 16-bit values (short), allowing support for higher-speed interfaces (10 Gbps and above).
spanning-tree pathcost method longWhen to Use This Command
- When deploying 10 Gigabit Ethernet interfaces that require path costs greater than the 16-bit maximum of 65535.
- When mixing high-speed and low-speed links in a network to ensure proper STP convergence and root bridge selection.
- When migrating from legacy 100 Mbps/Fast Ethernet to Gigabit or 10 Gigabit Ethernet and need consistent path cost calculations.
- When using Rapid PVST+ or MST and want to leverage the extended range of path costs for better load balancing.
Command Examples
Enable long path cost method globally
spanning-tree pathcost method longNo output is displayed upon successful configuration. The command is entered in global configuration mode and takes effect immediately for all interfaces.
Verify the path cost method
show spanning-treeVLAN0001
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.4455
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi1/0/1 Desg FWD 20000 128.1 P2p
Gi1/0/2 Desg FWD 20000 128.2 P2p
Te2/0/1 Desg FWD 2000 128.3 P2pThe 'Cost' column shows path costs. With long method, GigabitEthernet (1 Gbps) cost is 20000, and 10 GigabitEthernet cost is 2000. Without long method, GigabitEthernet cost would be 4 (short) and 10 GigabitEthernet would be 2, but long method allows higher granularity.
Understanding the Output
The 'show spanning-tree' command displays the STP state per VLAN. The 'Cost' column under each interface shows the path cost to the root bridge. With the long method, costs are 32-bit values (range 1 to 200,000,000). Typical values: 10 Mbps = 2,000,000; 100 Mbps = 200,000; 1 Gbps = 20,000; 10 Gbps = 2,000; 100 Gbps = 200. Lower cost indicates a more preferred path. If you see costs like 4 for GigabitEthernet, the long method is not enabled. Ensure all switches in the network use the same method to avoid loops or suboptimal paths.
CCNA Exam Tips
CCNA exam may ask: Which command allows STP to support 10 Gbps interfaces? Answer: 'spanning-tree pathcost method long'.
Remember that the long method is required for speeds above 10 Gbps (e.g., 40 Gbps, 100 Gbps) because short method maxes out at 65535.
The command is global; it affects all VLANs and all STP instances (PVST+, Rapid PVST+, MST).
Be aware that changing the path cost method can cause temporary STP reconvergence; the exam might test the impact on network stability.
Common Mistakes
Applying the command in interface configuration mode instead of global configuration mode — it is a global command only.
Assuming the long method is default on newer switches — it is not; you must explicitly configure it.
Forgetting to configure the same method on all switches in the network, leading to inconsistent path cost calculations and potential loops.
Related Commands
show spanning-tree
Displays the Spanning Tree Protocol (STP) state and configuration for all VLANs or a specific VLAN, used to verify root bridge, port roles, and STP topology.
spanning-tree port-priority [value]
Sets the port priority value for a specific interface to influence which port becomes the root port in a Spanning Tree topology.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions