ip ospf cost

 

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

 

ip ospf cost cost

no ip ospf cost

 

Syntax Description

cost

Unsigned integer value expressed as the link state metric. It can be a value in the range 1 to 65535.

 

Default

No default cost is predefined.

 

Command Mode

Interface configuration

 

Usage Guidelines

This command first appeared in Cisco IOS Release 10.0.

 

You can set the metric manually using this command, if you need to change the default. Using the bandwidth command changes the link cost as long as this command is not used.

 

The link state metric is advertised as the link cost in the router link advertisement. We do not support type of service (TOS), so you can assign only one cost per interface.

 

In general, the path cost is calculated using the following formula:

 

108 ÷ Bandwidth

 

Using this formula, the default path costs were calculated as noted in the following list. If these values do not suit your network, you can use your own method of calculating path costs.

 

56-kbps serial link--Default cost is 1785

 

64-kbps serial link--Default cost is 1562

 

T1 (1.544-Mbps serial link)--Default cost is 65

 

E1 (2.048-Mbps serial link)--Default cost is 48

 

4-Mbps Token Ring--Default cost is 25

 

Ethernet--Default cost is 10

 

16-Mbps Token Ring--Default cost is 6

 

FDDI--Default cost is 1

 

Example

The following example sets the interface cost value to 65:

 

ip ospf cost 65