router ospf reference-cost


router [ospf | ospfv3] reference-cost [0-16777215]

no router [ospf | ospfv3] reference-cost


Configures the global level cost for OSPF at the VLAN level. The global cost will become the default cost.

The no form of the command removes the configured global cost for OSPF.


In the event that the cost is explicitly configured at the VLAN level, the locally configured cost will take precedence over the global level cost.

Command context

Required context: config



Select the correct version of OSPF.


Specifies the global cost range for OSPF at the VLAN level.

Use cases

Use cases for the configuration of costs automatically from global level to VLAN level:

  1. Verify that the globally configured cost is applied at the VLAN level when configured without explicit cost parameters.

  2. Verify that the globally configured cost is applied on the VLAN level when the existing VLAN level cost is unconfigured.

  3. Verify that the auto configured cost is considered in OSPF neighbors for cost-related OSPF operations (such as shortest path selection).

  4. Verify that the existing command implementation is not affected due to an automatic cost configuration on both the global and the VLAN level.

  5. Check that the configuration is applied properly after uploading and downloading a saved configuration through TFTP.

  6. Verify the configuration by saving the configuration write mem and rebooting the system.

  7. When the area is already configured for VLAN, only OSPF cost will be applied.