Introduction
Metric calculation is a critical component for any routing protocol. 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 will discuss the two best-path-calculating routing protocols i.e., OSPF and EIGRP.To learn more about these protocols, you can take part in our OSPF BGP Training.
About OSPF
OSPF stands for Open Shortest Path First, is a dynamic routing protocol commonly used in large-scale networks, such as the internet or enterprise networks. It is an interior gateway protocol (IGP) designed to determine the most efficient routes for IP packet forwarding within a network.
OSPF Protocol operates by exchanging link-state advertisements (LSAs) between routers to build and maintain a topology database of the network. Each router uses this database to calculate the shortest path to reach a destination network, taking into account factors like link costs and network congestion.
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 OSPF 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.
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.

Optimizing OSPF Path Selection for High-Speed Infrastructure
Modern networks run on 10Gbps or 100Gbps connections, and the OSPF default reference bandwidth of 100Mbps is a problem. Since OSPF cost has to be a whole number, it reaches a “ceiling”, which means it can’t distinguish between high-speed interfaces. By default, OSPF assigns a cost of 1 for a link of 100 Mbps, as well as a 10 Gbps link or even a 100 Gbps link. The lack of granularity can mean your router could send traffic via the congested 100Mbps path instead of a free 100Gbps fiber line, because it sees them as having the similar “cost”.
In order to fix this, it is necessary to manually change your reference bandwidth to be in line with the fastest available link, which is typically 100,000 for 100Gbps networks. All this can be achieved via the auto-cost reference-bandwidth command. This will ensure that the SPF algorithm can precisely prioritize the highest-capacity network.
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.
About EIGRP
EIGRP stands for Enhanced Interior Gateway Routing Protocol. It is a dynamic routing protocol developed by Cisco Systems and is primarily used in enterprise networks offering advanced features for efficient and scalable routing.
EIGRP is a hybrid routing protocol that incorporates elements of both distance vector and link-state protocols. It uses the Diffusing Update Algorithm (DUAL) to calculate the shortest path to a destination network and maintain a routing table.
What are EIGRP K-Values?
In EIGRP, K-Values are parameters that determine how different network characteristics contribute to the overall metric calculation. There are 5 K-Values used by EIGRP to weigh various factors while calculating metric. These K-Values allow network admins to customize the metric calculation according to the specific network requirements.
Here is the explanation of these 5 K-Values –
- K1 (Bandwidth) – This value represents the bandwidth of the path, and it determines the contribution of the path’s bandwidth to the metric calculation.
- K2 (Load) – K2 represents the current load on the path.
- K3 (Delay) – K3 reflects the delay or latency of the path.
- K4 (Reliability) – K4 represents the reliability of the path.
- K5 (MTU – Maximum Transmission Unit) – This value represents the Maximum Transmission Unit of the path.
Network admins can change the values and prioritize the K-values as per needs when calculating metric. It’s important to note that the default values for the K-values in EIGRP are 1 for K1, K3, K5, and 0 for K2 and K4. However, these values can be modified to suit specific network requirements.
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 as discussed above.
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.
You should also check out – OSPF vs EIGRP
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.
EIGRP Classic Metric Formula with Default K-values
The default K-values for the route’s EIGRP metric calculation algorithm are K1 and K3, which should always be 1, and K2, K4, and K5, which should always be 0. The IGRP metric formula is used to create the EIGRP formula, which is then multiplied by 256 to increase the calculation’s precision from 24 to 32 bits.

When we calculate the above equation with default K-Values, we will get the EIGRP Metric Formula.

Mastering Advanced Metrics for Next-Gen Networks
The classic formulas for network metrics are a great starting point, but they often struggle with the demands of modern infrastructure. When managing 10Gbps or 100Gbps links, the standard “out-of-the-box” math can become a bottleneck. To keep your traffic flowing efficiently, you need to understand how these protocols have evolved to handle high-speed fiber.
The Evolution: EIGRP Wide Metrics
The original 32-bit EIGRP formula was designed for an era when 100Mbps was the gold standard. Because it uses microseconds for delay, it lacks the precision needed to distinguish between a 1Gbps and a 10Gbps path.
To solve this, Cisco introduced Wide Metrics (available in EIGRP Named Mode). This 64-bit calculation uses picoseconds (10^-12) instead of microseconds, offering much finer detail for modern links.
The New Wide Metric Formula and K6
The Wide Metric formula introduces a new variable, K6, and changes how we calculate throughput and latency:
Metric = [(K1Minimum Throughput + {K2Minimum Throughput} / 256-Load) + (K3Total Latency) + (K6Extended Attributes)]* [K5/(K4 + Reliability)]
- Throughput Calculation: This is defined as (10^7* 65536)/Bandwidth, where 65536 is the wide-scale constant.
- The Role of K6: While K1 through K5 remains familiar, K6 is a future-proofing addition. It is currently set to zero but is reserved to eventually account for “Extended Attributes” like energy consumption or jitter.
- Latency Logic: For links above 1Gbps, the formula shifts to (10^7* 65536/10)/ Bandwidth to ensure the math stays accurate at extreme speeds.
Scaling the RIB (Routing Information Base)
Because these 64-bit numbers are so large, they cannot fit into the router standard 4-byte RIB. You must use the metric rib-scale command to compress these values, so the router can process them correctly.
EIGRP DUAL–DIFFUSED UPDATE ALGORITHM
While metrics determine the “best” path, the Diffusing Update Algorithm (DUAL) is the engine that ensures the network remains loop-free and stable. In a modern environment using Wide Metrics, DUAL utilizes the following four parameters to manage the topology:
- 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.
OSPF Scaling vs. EIGRP Wide Metrics
| Feature | EIGRP Solution | OSPF Solution |
| Modern Support | Wide Metrics: Moves to 64-bit math and picoseconds. | Reference BW: Increases the numerator manually. |
| Future Proofing | K6 Attribute:Â Reserved for new network metadata. | Reference BW:Â Scalable up to 4.2 million Mbps. |
| Requirement | Requires EIGRP Named Mode. | Works in Standard OSPF. |
Frequently Asked Questions
Q1. What are the 5 metrics used by EIGRP to calculate the route?
The 5 metrics used by EIGRP to calculate the route are also known as composite metrics or components of the EIGRP metric. These are Bandwidth, Delay, Reliability, Load and MTU (Maximum Transmission Unit).
Q2. Is lower metric better for EIGRP?
Yes, in EIGRP, a lower metric is considered better. The metric in EIGRP represents the overall cost or desirability of a route. When multiple paths are available to reach a destination, EIGRP selects the path with the lowest metric as the best route.
Q3. What is K value in EIGRP?
K-Values in EIGRP are parameters used to determine the importance or weight of different network characteristics when calculating the overall metric for a route. EIGRP uses 5 K-Values from K1 to K5.
Q4. What is the hop count for EIGRP?
The Hop count in EIGRP refers to the number of routers or network segments that a packet must traverse to reach its destination. However, it’s important to note that hop count is not the primary metric used by EIGRP for route selection.
Conclusion
We have discussed both EIGRP and OSPF Metric Calculation. 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.
While the fundamental formulas remain the same, modern high-speed networks require us to move beyond Classic Metrics. Whether it’s shifting to EIGRP Wide Metrics or adjusting OSPF Reference Bandwidth to 100G, understanding the math behind the protocol is the only way to ensure optimal path selection.
Understanding routing metrics is essential for designing reliable and high-performance networks.
If you want guidance on learning OSPF, EIGRP, or enterprise routing the right way, you can get a free career consultation on WhatsApp.








