OSPF cost of S series switches

The ospf cost command can be executed on an S series switch that supports OSPF to configure the cost required for running the OSPF protocol on an interface.
Application scenario:
The interface cost can be automatically calculated by OSPF based on the interface bandwidth or manually configured by using the ospf cost command.
If the costs and destination IP addresses of multiple routes discovered by one routing protocol are the same, load balancing can be implemented among the routes. Modify interface costs to implement load balancing as required.
Configuration impact:
If no interface cost is configured by using the ospf cost command, OSPF automatically calculates the interface cost based on the interface bandwidth. The calculation formula is as follows: Cost of the interface = Bandwidth reference value/Interface bandwidth. The integer of the calculated result is the cost of the interface. If the calculated result is smaller than 1, the cost value is 1. Changing the bandwidth reference value can change the cost of an interface.
By default, the bandwidth reference value is 100 Mbit/s. Therefore, the default cost value of an Ethernet (100 Mbit/s) interface is 1 (100,000,000/the interface bandwidth).
Set the cost required by VLANIF 100 for running OSPF to 65.

[HUAWEI] interface vlanif 100
[HUAWEI-Vlanif100] ospf cost 65
Set the cost required by GE0/0/1 for running OSPF to 65.
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] undo portswitch
[HUAWEI-GigabitEthernet0/0/1] ospf cost 65
Note: The cost calculated by OSPF is the cost of the route to the outbound interface of the destination network.

Scroll to top