auto-cost (OSPF)

To control how Open Shortest Path First (OSPF) calculates default metrics for an interface, use the auto-cost command. To assign the default reference bandwidth of 40 Gb/s, use the no form of this command.

auto-cost reference-bandwidth bandwidth [ Gbps | Mbps ]

no auto-cost reference-bandwidth

Syntax Description

reference-bandwidth bandwidth
Sets the reference bandwidth used to calculate the default metrics for an interface. The range depends on whether you use the Gbps or MBps keywords.
(Optional) Specifies the rate in Gbps (bandwidth). The range is from 1 to 4000; the default is 40.
(Optional) Specifies the rate in Mbps (bandwidth). The range is from 1 to 4000000; the default is 40000.

Command Default

40 Gb/s. The bandwidth defaults to Gb/s if you do not specify the Gpbs or Mbps keyword.

Command Modes

Router configuration mode

Command History

This command was introduced.

Usage Guidelines

Use the auto-cost command to set the reference bandwidth used by the OSPF cost-metric calculation.

The value set by the ip ospf cost command overrides the cost that results from the auto-cost command.

This command requires the LAN Base Services license.


This example shows how to set the reference bandwidth for all local interfaces in an OSPF instance:

switch(config)# router ospf 201
switch(config-router)# auto-cost reference-bandwidth 10

Related Commands

ip ospf cost
Explicitly specifies the cost of sending a packet on an interface.