< Home

stp cost

Function

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.

Format

STP/RSTP/MSTP: stp [ process process-id ] [ instance instance-id ] cost cost

VBST: stp [ vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> ] cost cost

STP/RSTP/MSTP: undo stp [ process process-id ] [ instance instance-id ] cost

VBST: undo stp [ vlan { vlan-id1 [ to vlan-id2 ] } &<1-10> ] cost

Parameters

Parameter Description Value

process process-id

Indicates the ID of an MSTP process.

If process process-id is not specified, the status and statistics of an MSTP process with the ID 0 will be displayed.

The value is a decimal integer ranging from 1 to 31.

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.

NOTE:

instance-id ranges from 0 to 4094. Each process supports a maximum of 65 instances.

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

vlan vlan-id1 [ to vlan-id2 ]

Specifies one or more VLANs in which the port path cost is set.
  • vlan-id1 specifies the start VLAN ID.
  • to vlan-id2 specifies the end VLAN ID. vlan-id2 must be greater than or equal to vlan-id1. vlan-id2 and vlan-id1 specify a VLAN range.
  • If to vlan-id2 is not specified, the port path cost is configured only for the VLAN specified by vlan-id1.

In the stp cost command, you can specify a maximum of 10 VLAN ranges.

NOTE:

VLANs can be specified only when VBST is running.

The value is an integer that ranges from 1 to 4094.

Views

Ethernet interface view, GE interface view, XGE interface view, MultiGE interface view, 40GE interface view, 100GE interface view, Eth-Trunk interface view, port group view, 25GE 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 1 Mappings between link rates and path costs (Huawei legacy standard)

Link Rate

Recommended Value

Default, Value

Recommended Value Range

Value Range

10 Mbit/s

2000

200-20000

1-200,000

100 Mbit/s

200

20-2000

1-200,000

1 Gbit/s

20

2-200

1-200,000

10 Gbit/s

2

2-20

1-200,000

Over 10 Gbit/s

1

1-2

1-200,000

Prerequisites

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

Precautions

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.

Example

# Set the path cost of GE0/0/1 in spanning tree instance 2 to 200 when STP/RSTP/MSTP is running.
<HUAWEI> system-view
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] stp instance 2 cost 200
# Set the path cost of GE0/0/1 in VLAN 10 to 300 when VBST is running.
<HUAWEI> system-view
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] stp vlan 10 cost 300
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >