ip ospf cost

To specify the cost of sending a packet on an interface, use the ip ospf cost command. To reset the path cost to the default, use the no form of this command.

ip ospf cost interface-cost

no ip ospf cost interface-cost

Syntax Description

Unsigned integer value expressed as the link-state metric. The range is from 1 to 65535.

Command Default

Calculates the cost based on the reference bandwidth divided by the configured interface bandwidth. You can configure the reference bandwidth or it defaults to 40 Gb/s.

Command Modes

Interface configuration mode

Command History

This command was introduced.

Usage Guidelines

Use the ip ospf cost command to configure the cost metric manually for each interface. This command overrides any settings for the reference bandwidth that you set using the reference-bandwidth command in router configuration mode.

If this command is not used, the link cost is calculated using the following formula:

This command requires the LAN Base Services license.


This example shows how to configure the interface cost value to 65:

switch(config)# interface ethernet 1/2
switch(config-if)# no switchport
switch(config-if)# ip ospf cost 65

Related Commands

Specifies the reference bandwidth that OSPF uses to calculate the link cost.