OSPF Metric

Each OSPF router executes Dijkstra’s SPF algorithm to compute the shortest-path tree from itself to every subnetwork in its area. However, RFC 2328 does not specify how a router should compute the cost of an attached network -- this is left to the vendor. Cisco computes the cost of an attached network as follows:

Cost = 108/bandwidth of interface in bits per second

Using this definition, the OSPF cost for some common media types is shown in Table 6-1. Table 6-1 assumes default interface bandwidth. Note that the cost is rounded down to the nearest integer.

Table 6-1. Default OSPF costs

Media type

Default bandwidth

Default OSPF cost

Ethernet

10 Mbps

10

Fast Ethernet

100 Mbps

1

FDDI

100 Mbps

1

T-1 (serial interface)[a]

1,544 kbps

64

56 kbps (serial interface)

1,544 kbps

64

HSSI

45,045 kbps

2

[a] All serial interfaces on Cisco routers are configured with the same default bandwidth (1,544 kbits/s) and delay (20,000 ms) parameters.

The OSPF cost computed by a router can be checked with the command show ip ospf interface , as in line 4 in the code block in the previous section, where the cost of the Ethernet segment is 10. The composite cost of reaching a destination is the sum of the individual costs of all networks in the path to the destination and can be seen as output of the show ip route command in lines 6, 7, and 8.

The default value of the OSPF metric may not be adequate in some situations. For example, in TraderMary’s configuration, the NewYork ...

Get IP Routing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.