(Optional) Setting a Path Cost for a Port
Context
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 |
Allowable 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 Layer 2 switches enabled with STP or RSTP on the same network must use the same path cost calculation algorithm.
- 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.
- 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.