No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search


To have a better experience, please upgrade your IE browser.


Fat AP and Cloud AP V200R010C00 Command Reference

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
stp cost

stp cost


The stp cost command sets the path cost of a port in a spanning tree.

The undo stp cost command restores the default path cost.

By default, the path cost of a port in a spanning tree is the path cost corresponding to the port rate.


stp [ instance instance-id ] cost cost

undo stp [ instance instance-id ] cost


Parameter Description Value
instance instance-id

Specifies the number of a spanning tree instance.

If instance instance-id is not specified, it indicates the path cost of an interface in CIST.

The value is an integer ranging from 0 to 4094. Value 0 refers to CIST.
cost Specifies the path cost of an interface. According to different calculation standards, the value ranges are as follows:
  • Huawei legacy standard: 1 to 200,000

  • IEEE 802.1d-1998 standard: 1 to 65535

  • IEEE 802.1t standard: 1 to 200,000,000


GE interface view, Eth-Trunk interface view, XGE interface view, MultiGE interface view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The path cost of a port is an important basis for calculating a spanning tree. Path costs determine root port selection. In a spanning tree, the port with the lowest path cost to the root bridge is selected as a root port.

If different path costs are set for a port on an MSTP device in different spanning tree instances, traffic of different VLANs will be forwarded along different physical links and VLAN-based load balancing can be carried out.

Path costs depend on path cost calculation standards. After the path cost calculation standard is determined, set a relatively small path cost within a specified range for a port that has a high link rate. In the Huawei legacy standard, default path costs for ports with different link rates are different, as shown in the following table.
Table 6-29  Mappings between link rates and path costs

Link Rate

Recommended Value

Default, Value

Recommended Value Range

Value Range

10 Mbit/s




100 Mbit/s




1 Gbit/s




10 Gbit/s




Over 10 Gbit/s





A path cost calculation standard has been set using the stp pathcost-standard command.


If the path cost of a port, the spanning tree where the port resides needs to be recalculated.

If the stp pathcost-standard command is used to change the path cost calculation standard, the path cost set using the stp cost command for a port will be restored to the default value.


# Set the path cost of GE0/0/1 in spanning tree instance 2 to 200.
<Huawei> system-view
[Huawei] interface gigabitethernet 0/0/1
[Huawei-GigabitEthernet0/0/1] stp instance 2 cost 200
Related Topics
Updated: 2019-11-21

Document ID: EDOC1100064352

Views: 206651

Downloads: 122

Average rating:
This Document Applies to these Products
Related Version
Related Documents
Previous Next