Setting an OSPF cost for an interface
Set an OSPF cost for an interface by using either of the following methods:
Set the cost value in interface view.
Set a bandwidth reference value for the interface. OSPF computes the cost with this formula: Interface OSPF cost = Bandwidth reference value (100 Mbps) / Expected interface bandwidth (Mbps). The expected bandwidth of an interface is configured with the bandwidth command (see Interface Command Reference).
If the calculated cost is greater than 65535, the value of 65535 is used. If the calculated cost is less than 1, the value of 1 is used.
If no cost or bandwidth reference value is configured for an interface, OSPF computes the interface cost based on the interface bandwidth and default bandwidth reference value.
To set an OSPF cost for an interface:
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter interface view. | interface interface-type interface-number | N/A |
3. Set an OSPF cost for the interface. | ospf cost cost-value | By default, the OSPF cost is calculated according to the interface bandwidth. For a loopback interface, the OSPF cost is 0 by default. |
To set a bandwidth reference value:
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter OSPF view. | ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] * | N/A |
3. Set a bandwidth reference value. | bandwidth-reference value | The default setting is 100 Mbps. |