stp cost
Use stp cost to set the path cost of a port.
Use undo stp cost to restore the default.
Syntax
stp [ instance instance-list | vlan vlan-id-list ] cost cost
undo stp [ instance instance-list | vlan vlan-id-list ] cost
Default
The device automatically calculates the path costs of ports in each spanning tree based on the corresponding standard.
Views
Layer 2 Ethernet interface view, Layer 2 aggregate interface view
Predefined user roles
network-admin
Parameters
instance instance-list: Specifies a space-separated list of up to 10 MSTI items. Each item specifies an MSTI or a range of MSTIs in the form of instance-id1 [ to instance-id2 ]. The value for instance-id2 must be equal to or greater than the value for instance-id1. The value range for the instance-id argument is 0 to 4094, and the value 0 represents the CIST.
vlan vlan-id-list: Specifies a space-separated list of up to 10 VLAN items. Each item specifies a VLAN or a range of VLANs in the form of vlan-id1 [ to vlan-id2 ]. The value for vlan-id2 must be equal to or greater than the value for vlan-id1. The value range for the vlan-id argument is 1 to 4094.
cost: Specifies the path cost of the port, with an effective range that depends on the path cost calculation standard that is used.
When the IEEE 802.1d-1998 standard is selected for path cost calculation, the value range for the cost argument is 1 to 65535.
When the IEEE 802.1t standard is selected for path cost calculation, the value range for the cost argument is 1 to 200000000.
When the private standard is selected for path cost calculation, the value range for the cost argument is 1 to 200000.
Usage guidelines
Path cost is an important factor in spanning tree calculation. Setting different path costs for a port in MSTIs allows VLAN traffic flows to be forwarded along different physical links. This results in VLAN-based load balancing.
The path cost setting of a port can affect the role selection of the port. When the path cost of a port is changed, the system calculates the role of the port and initiates a state transition.
When the command is configured in Layer 2 Ethernet interface view, it takes effect only on that interface.
When the command is configured in Layer 2 aggregate interface view, it takes effect only on the aggregate interface.
When the command is configured on a member port in an aggregation group, is takes effect only after the port leaves the aggregation group.
If you do not specify an MSTI or VLAN, this command sets the path cost of the ports in the MSTP CIST or in the STP or RSTP spanning tree.
Examples
# In MSTP mode, set the path cost of port Ten-GigabitEthernet 1/0/3 in MSTI 2 to 200.
<Sysname> system-view [Sysname] interface ten-gigabitethernet 1/0/3 [Sysname-Ten-GigabitEthernet1/0/3] stp instance 2 cost 200
# In PVST mode, set the path cost of port Ten-GigabitEthernet 1/0/3 in VLAN 2 to 200.
<Sysname> system-view [Sysname] interface ten-gigabitethernet 1/0/3 [Sysname-Ten-GigabitEthernet1/0/3] stp vlan 2 cost 200
Related commands
display stp
stp pathcost-standard