(Optional) Configuring a Path Cost for a Port
Context
A path cost is the reference value used for link selection on an STP/RSTP network.
The path cost value range is determined by the calculation method. After the calculation method is determined, it is recommended that you set smaller path cost values for the ports with higher link rates.
Link Rate |
Recommended Path Cost |
Recommended Path Cost Range |
Supported Path Cost Range |
---|---|---|---|
10 Mbit/s |
2000 |
200 to 20000 |
1 to 200000 |
100 Mbit/s |
200 |
20 to 2000 |
1 to 200000 |
1 Gbit/s |
20 |
2 to 200 |
1 to 200000 |
10 Gbit/s |
2 |
2 to 20 |
1 to 200000 |
Over 10 Gbit/s |
1 |
1 to 2 |
1 to 200000 |
If a network has loops, it is recommended that you set a large path cost for ports with low link rates. STP/RSTP then blocks these ports.
Procedure
- Run system-view
The system view is displayed.
- (Optional) Run stp pathcost-standard { dot1d-1998 | dot1t | legacy }
A path cost calculation method is specified.
By default, the IEEE 802.1t standard (dot1t) is used to calculate the path costs.
All devices on a network must use the same path cost calculation method.
- Run interface interface-type interface-number
The view of an interface participating in STP calculation is displayed.
- Run stp cost cost
A path cost is set for the interface.
The following describes the supported cost range for different calculation methods:
- When the Huawei calculation method is used, cost ranges from 1 to 200000.
- When the IEEE 802.1d standard method is used, cost ranges from 1 to 65535.
- When the IEEE 802.1t standard method is used, cost ranges from 1 to 200000000.
- If an Eth-Trunk interface is specified as the member interface of an M-LAG configured in V-STP mode, the path cost of the Eth-Trunk interface is fixed at 2000.
- Run commit
The configuration is committed.