You can manually set a link cost for an OSPF interface or allow OSPF to automatically calculate the cost according to the interface bandwidth. The calculation formula is as follows:
Cost of an interface = Bandwidth reference value/Interface bandwidth.
The integer of the calculated result is used as 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. To manually set the link cost or change the bandwidth reference value and interface bandwidth, perform the following steps.
The calculation formula is as follows: Cost of the interface = Bandwidth reference value/Interface bandwidth. The integer of the calculation result is used as the cost of the interface. If the result is less than 1, the cost is 1.
To use the bandwidth reference value to determine the interface cost, run the bandwidth-reference command.
To use the interface bandwidth to determine the interface cost, run the bandwidth command to set configuration bandwidth for an interface, and then run the bandwidth-config enable command to enable the device to calculate the cost for the interface based on the configuration bandwidth of the interface.
To use both the bandwidth reference value and interface bandwidth to determine the interface cost, select the preceding configuration.