## OSPF Metric and Reference Bandwidth

OSPF uses “Cost” as the value of the metric and uses a Reference Bandwidth of 100 Mbps for cost calculation. A lower-cost indicates a better path than a higher cost. A routing protocol uses a metric to determine the best path of a packet across a network. An OSPF metric provides a sign of the overhead across a certain interface for packet sending.

The cost of an interface is inversely proportional to the bandwidth of the interface. So, a higher bandwidth provides a lower cost and more overhead and time delays equal a higher cost. Therefore, a 100-Mb/s Ethernet line has a higher cost than a 1000-Mb/s Ethernet line. The image below illustrates the formula for cost calculation

The value of the reference cost is 100Mbps = 100,000,000 bps, So the formula:

The default OSPF cost formula doesn’t differentiate between interfaces with bandwidth faster than 100 Mbps. The FastEthernet, Gigabit Ethernet, and 10 GigE interfaces share the same cost because the OSPF cost value must be an integer. Therefore, the default reference bandwidth is set to 100 Mb/s, and all links that are faster than Fast Ethernet also have a cost of 1. The cost value for different types of interfaces are the following: ## OSPF Accumulates Costs The cost of an OSPF route is the accumulated value from the source to the destination network. For example, in Figure 2, there are two routes from Router1 LAN to Router2 LAN. The cost to reach the Router2 LAN from Router1 LAN as follows:

First Route

• Router1 Fast Ethernet 0/0 = 1
• Router2 Ethernet = 10
• The total cost to reach 192.168.20.0=11

2nd Route

• Router1 Giga Ethernet 0/1 = 1
• Router3 Serial 1/1/0 = 781
• Router2 Ethernet = 10

Total cost to reach 192.168.20.0= 792

The routing table of Router1 for network 192.168.20.0 in Figure 3 confirms the metric to reach the Router2 LAN is a cost of 11.  