Best Path Calculation Methods - OSPF and EIGRP Metric Calculation

OSPF metric calculation is used to find the shortest path by using cost as a metric and determining the cost of paths to know the best path to the destination. Before understanding the OSPF and EIGRP Metric calculation, you need to know that:
The automatic and dynamic exchange of routing information between routers is made possible by the use of routing protocols. Numerous routing protocols exist, each with its own set of advantages and disadvantages due to being tailored to perform best in a certain kind of network deployment. Open Shortest Path First (OSPF) and Enhanced Interior Gateway Routing Protocol (EIGRP) are two of the most widely deployed routing protocols. In this article, we'll explain and comprehend the two best-path-calculating routing protocols.
OSPF Metric Calculation
As we know, OSPF is a link state protocol, so the router learns all the paths and their costs to the destination and selects the routes with the lowest costs to the destination. This is known as OSPF Metric calculation.
Metric – It is a parameter that OSPF uses to choose its best path. OSPF metrics are calculated using a cost-based algorithm.
For any given interface, the cost is always inversely proportional to the bandwidth.
- A higher bandwidth leads to a lower cost.
- A lower bandwidth leads to a higher cost.
So, the path with the lowest cost will be the best path for OSPF.
Now, as we know, OSPF utilizes link-state advertisements for network destinations, and it is known as a link-state routing protocol. For this reason, the (shortest path first) SPF algorithm is used for routing calculations based on link-state information. With OSPF, all routers share metrics and link-state information about their connected interfaces with each other.
Let's move on to know more about the shortest-path-first algorithm.
SPF Algorithm
Specifically, OSPF employs a (shortest-path-first) SPF algorithm to determine and construct the shortest route to all known destinations.
- In OSPF, routers generate a link state advertisement (LSA). This advertisement depicts the all-link states of the router.
- All routers in OSPF exchange link states by flooding LSAs. Every router that receives an LSA will store a copy of its link-state database and then forward the LSA to other routers.
- Once the database of every router is synced, it will calculate the shortest path to all possible destinations, which we call the shortest path tree (SPT).
- The algorithm puts every router in a tree and determines the shortest path to each destination by taking into account the total cost of getting there.
- Lastly, when the router builds the SPT, it starts creating the routing table.
We hope you have a good overview of the SPF Algorithm. Let's understand the OSPF cost formula now.
You can learn more about OSPF from this video -
OSPF Cost Formula
The formula used by OSPF to determine cost is as follows:
Cost = Reference bandwidth/Interface bandwidth
In OSPF's documentation (RFC 2338), reference bandwidth was given a completely random number. Each manufacturer must determine its reference bandwidth. When referring to bandwidth, Cisco uses 100 Mbps (108) as reference bandwidth. With this, the equation would be:
Cost = 108/interface bandwidth in bps
Some of the key points to follow while calculating cost is discussed below.
Key points -
- Cost is a positive integer value.
- All decimal values will be rounded to the nearest positive integer.
- Any value in decimal or less than 1 will be considered 1.
Now that we have the formula let's perform the arithmetic and get the base cost of the necessary interfaces.
Default cost of essential interfaces.
Interface type | Bandwidth | Metric Calculation | Cost |
Serial Link | 1544Kbps | 100000000/1544000 = 64.76 | 64 |
Ethernet Link | 10Mbps | 100000000/10000000 = 10 | 10 |
FastEthernet Link | 100Mbps | 100000000/100000000 = 1 | 1 |
The image below shows the default OSPF Cost values for various interface bandwidths.

How to check the cost of a link?
#show ip ospf interface fa0/0 | include cost
How to change the reference bandwidth?
Router(config)#Router ospf 1
Router(config)#auto-cost reference-bandwidth 10000 (in Mbps)
How to check reference bandwidth?
#Show ip ospf | include reference
How to check the bandwidth of a link?
#Show ip ospf interface fa0/0 | include BW
This is everything you need to learn about OSPF Metric Calculation. Moving on to the EIGRP Section.
EIGRP Metric Calculation
Just like OSPF, EIGRP also has a metric calculation. The Metric of EIGRP depends on five parameters which are considered as K-Values.
These parameters are:
- Bandwidth - In computing, it is the quantity of information that can be sent through a connection in a certain length of time. Bandwidth is measured in Kilobits.
- Load – It is defined as the traffic passing through the interface. It is measured on a scale of 255 where 1 represents that an interface is empty and 255 represents that an interface is fully utilized.
- Delay – The time that has been passed in processing a particular packet. It is generally calculated in microseconds.
- Reliability - It is expressed on a scale of 0 to 255. Where 255 expresses 100% reliability, and 0 represents 0% reliability.
- MTU - stands for Maximum Transmission Unit.
So, EIGRP uses these five factors (Bandwidth, Delay, Reliability, Load, and MTU) to calculate its metric, i.e., cost.
CISCO technically calls these five factors K Values which are represented as shown in the image below -

Because load and reliability are dynamic variables, EIGRP's default metric calculation values are (K1 & K3). However, the EIGRP procedure will become a more over-headed protocol if these values are constantly updated.
EIGRP Metric calculation formula
Formula used for EIGRP Metric = (10^7/BW + Delay/10)} *256
Now that we have learned about EIGRP Metric Calculation, it is time to under the EIGRP dual-diffused update algorithm.
You can learn more about how EIGRP Metric Calculation is done from this video -
EIGRP DUAL–DIFFUSED UPDATE ALGORITHM
DUAL Algorithm uses four parameters –
- Feasible distance (FD): Total cost from the local router to the destination.
- Advertised distance/Reported distance (AD/RD): Cost from the next-hop router to the destination.
- Successor: The best path of EIGRP to reach a destination network. It is Stored in the routing table as well as the topology table.
- Feasible successor: A backup path that is stored in the topology table only.
The Feasibility Condition states that a route will not be accepted if the Reported Distance exceeds the best path's Feasible Distance.
Conclusion
Open Shortest Path First (OSPF) and the extended Interior Gateway Routing Protocol (EIGRP) are two of the most widely deployed IGPs today. Both are commonly used in various business networks and have shown to be stable and reliable options throughout the years. The OSPF metric calculation depends on a metric known as cost; the lower the cost, the more suitable path will be. At the same time, EIGRP Metric Calculation is dependent on five factors.
Continue Reading -
OSPF LSA
QoS in Networking
EIGRP Interview questions
OSPF Interview questions
If you are eager to learn more about EIGRP and OSPF Metric Calculation, you should join PyNet Labs' CCNP ENCOR Training. The CCNP ENCOR training will help you comprehend all the advanced networking skills, including OSPF and EIGRP. If you are a network engineer who wants to grow in your career, then you should check out PyNet Labs' Job Guarantee Courses. These courses will help you upskill and get your dream networking job.