How the spanning tree path cost will be calculated on a port-channel ?

Steven_zhangCreated at:Dec 11, 2019 14:06:54Updated at:Dec 11, 2019 14:06:58

Path Cost is used by the Spanning Tree Algorithm to determine the best path between devices.
Therefore, lower values should be assigned to ports attached to faster media, and higher values assigned to ports with slower media.

By default, the system automatically detects the speed and duplex mode used on each port, and configures the path cost according to the values shown below.mceclip0.png

*The path cost of the STP is not configured by pathcost method short or long.

User can configure the spanning tree path cost for the specified interface by following command.
[CLI Command]
spanning-tree cost {cost}
  cost - The path cost for the port.
  (Range: 0 for auto-configuration, 1-65535 for short path cost method, 1-200,000,000 for long path cost method)

 

Calculate the spanning tree path cost on a port-channel.

1. Active Eth1/1 for port channel.

Console#show interfaces brief
Interface Name              Status    PVID Pri Speed/Duplex  Type         Trunk
--------- ----------------- --------- ---- --- ------------- ------------ -----
Eth 1/ 1                    Up           1   0 Auto-1000full 1000BASE-T   1

The spanning tree path cost on Trunk 1 is 5000.

Console#show spanning-tree brief
Interface Pri Designated            Designated Oper     STP    Role State Oper
              Bridge ID             Port ID    Cost     Status            Edge
--------- --- --------------------- ---------- -------- ------ ---- ----- ----
Trunk 1   128 32768.8CEA1B8AC667    128.57         5000 EN     ROOT FWD   No

The spanning tree path cost for Trunk 1 is 10000 (1G) / 2 = 5000 (Trunk).
The spanning tree path cost on Trunk 1 is 5000 (Trunk) / 1 = 5000.


2. Active Eth1/1 & Eth1/2 for port channel.

Console#show interfaces brief
Interface Name              Status    PVID Pri Speed/Duplex  Type         Trunk
--------- ----------------- --------- ---- --- ------------- ------------ -----
Eth 1/ 1                    Up           1   0 Auto-1000full 1000BASE-T   1
Eth 1/ 2                    Up           1   0 Auto-1000full 1000BASE-T   1

The spanning tree path cost on Trunk 1 is 2500.

Console#show spanning-tree brief
Interface Pri Designated            Designated Oper     STP    Role State Oper
              Bridge ID             Port ID    Cost     Status            Edge
--------- --- --------------------- ---------- -------- ------ ---- ----- ----
Trunk 1   128 32768.8CEA1B8AC667    128.57         2500 EN     ROOT FWD   No

The spanning tree path cost on Trunk 1 is 5000 (Trunk) / 2 = 2500.


3. Active Eth1/1 & Eth1/2 & Eth1/3 for port channel.

Console#show interfaces brief
Interface Name              Status    PVID Pri Speed/Duplex  Type         Trunk
--------- ----------------- --------- ---- --- ------------- ------------ -----
Eth 1/ 1                    Up           1   0 Auto-1000full 1000BASE-T   1
Eth 1/ 2                    Up           1   0 Auto-1000full 1000BASE-T   1
Eth 1/ 3                    Up           1   0 Auto-1000full 1000BASE-T   1

The spanning tree path cost on Trunk 1 is 1666.

Console#show spanning-tree brief
Interface Pri Designated            Designated Oper     STP    Role State Oper
              Bridge ID             Port ID    Cost     Status            Edge
--------- --- --------------------- ---------- -------- ------ ---- ----- ----
Trunk 1   128 32768.8CEA1B8AC667    128.57         1666 EN     ROOT FWD   No

The spanning tree path cost on Trunk 1 is 5000 (Trunk) / 3 = 1666.

 

4. Active Eth1/1 & Eth1/2 & Eth1/3 & Eth1/4 for port channel.

Console#show interfaces brief
Interface Name              Status    PVID Pri Speed/Duplex  Type         Trunk
--------- ----------------- --------- ---- --- ------------- ------------ -----
Eth 1/ 1                    Up           1   0 Auto-1000full 1000BASE-T   1
Eth 1/ 2                    Up           1   0 Auto-1000full 1000BASE-T   1
Eth 1/ 3                    Up           1   0 Auto-1000full 1000BASE-T   1
Eth 1/ 4                    Up           1   0 Auto-1000full 1000BASE-T   1

The spanning tree path cost on Trunk 1 is 1250.

Console#show spanning-tree brief
Interface Pri Designated            Designated Oper     STP    Role State Oper
              Bridge ID             Port ID    Cost     Status            Edge
--------- --- --------------------- ---------- -------- ------ ---- ----- ----
Trunk 1   128 32768.8CEA1B8AC667    128.57         1250 EN     ROOT FWD   No

The spanning tree path cost on Trunk 1 is 5000 (Trunk) / 4 = 1250.