Vyatta Network OS Documentation

Learn how to install, configure and operate the Vyatta NOS, which helps drive our virtual networking & physical platforms portfolio.

interfaces <interface> <interface-name> ip ospf cost <cost>

Sets the routing cost of OSPF on an interface.

set interfaces interface interface-name ip ospf cost cost
delete interfaces interface interface-name ip ospf cost
show interfaces interface interface-name ip ospf cost

For details on the default of OSPF cost, refer to the usage guidelines that follow.

interface
A type of interface. For detailed keywords and arguments that can be specified as interface types, refer to Supported Interface Types.
interface-name
The name of an interface.
cost
The link-state metric (OSPF cost) to be advertised in the link-state advertisement (LSA) as the cost of sending packets over the interface. The cost ranges from 1 through 65535.

Configuration mode

interfaces {
	interfaces interface-name {
		ip {
			ospf {
				cost cost
			}
		}
	}
}

Use this command to manually override the default cost of OSPF that is computed by the system on an interface. Only one cost can be set for each interface.

By default, the metric that is associated with a link is computed as follows:

Cost = 108 / bandwidth

The cost of reaching any destination is the sum of the costs of the individual hops. Costs are always rounded to the nearest integer. Costs lower than 1 are rounded up to 1.

OSPF Costs for Common Media Types shows the OSPF costs for some common media types.

Table 1. OSPF Costs for Common Media Types
Media Type OSPF Cost

56 Kbps

1785

64 Kbps

1562

128 Kbps

781

256 Kbps

390

512 Kbps

195

768 Kbps

130

T1 (1.544 Mbps)

64

E1 (2.048 Mbps)

48

4 Mbps Token Ring

6

10 Mbps Ethernet

10

16 Mbps Token Ring

6

T3 (44.736 Mbps)

2

100+ Mbps

1

The values in OSPF Costs for Common Media Types show how OSPF fails to distinguish between interfaces that are faster than 100 Mbps, for example, between Fast Ethernet (100 Mbps) and Gigabit Ethernet (1000 Mbps) interfaces. If you want to distinguish interfaces equal to or greater than 100 Mbps, you must manually configure the cost of the interface by using this command.

Use the set form of this command to set the cost of OSPF on an interface.

Use the delete form of this command to restore the default cost of OSPF on an interface.

Use the show form of this command to display the cost of OSPF on an interface.