Skip to main content
Network Routing – Complete Beginner to Advanced Guide
CHAPTER 10 Beginner

Routing Metrics and Path Selection

Updated: May 15, 2026
20 min read

# CHAPTER 10

Routing Metrics and Path Selection

1. Introduction

In previous chapters, we established that a router uses the Longest Prefix Match to find the correct destination, and Administrative Distance to decide which protocol to trust. But what happens when OSPF presents the router with *two different paths* to the exact same destination? How does the mathematical algorithm declare one path a "winner" and the other a "loser"? The answer lies in Routing Metrics. In this chapter, we will dissect the variables that dynamic protocols use to calculate the "Cost" of a route—specifically Bandwidth, Delay, and Reliability. We will also explore what happens when two paths result in a mathematical tie, leading to the powerful concept of Load Balancing.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Define what a Routing Metric is in the context of dynamic algorithms.
  • Contrast the simplistic metrics (Hop Count) with composite metrics (Bandwidth/Delay).
  • Understand how OSPF uses purely Bandwidth to calculate Cost.
  • Understand how advanced protocols (like EIGRP) use complex composite metrics.
  • Explain the concept and advantages of Equal-Cost Multi-Path (ECMP) Load Balancing.

3. Beginner-friendly Explanations

The GPS Route Options: When you open a GPS app to drive to the airport, it gives you three options:
  • Route 1: 15 miles, highway, takes 20 minutes.
  • Route 2: 10 miles, backroads, takes 35 minutes.
  • Route 3: 15 miles, highway, but a toll booth costs $5.

How does the app decide which route to highlight in blue? It uses an algorithm (a Metric). If the algorithm is programmed to prioritize "Shortest Distance," it picks Route 2. If it is programmed to prioritize "Fastest Time," it picks Route 1.

Routers do the exact same thing. The dynamic routing protocol runs an algorithm against the physical cables to determine the "cheapest" path.

4. The Primary Metric Variables

Different routing protocols care about different variables.
  1. 1. Hop Count (RIP): As discussed, RIP only cares about the number of routers crossed. It is blind to speed.
  1. 2. Bandwidth (OSPF): OSPF looks at the physical speed limit of the cable (e.g., 100 Mbps vs 1 Gbps). It mathematically divides a reference bandwidth by the interface speed to generate a "Cost." The higher the bandwidth, the lower the Cost.
  1. 3. Delay: The sheer amount of time (in microseconds) it takes a packet to traverse a link. A satellite link might have massive bandwidth, but terrible delay.
  1. 4. Reliability: Is the cable degraded? Is it dropping 5% of packets due to physical damage?

*(Note: Advanced Cisco protocols like EIGRP use a complex "Composite Metric" formula that calculates Bandwidth + Delay simultaneously to find the most optimal path).*

5. Path Manipulation (Traffic Engineering)

The true skill of a network engineer is manipulating these metrics. Suppose OSPF calculates that Path A (Cost 10) is better than Path B (Cost 50). But Path A routes traffic through the CEO's personal office router, slowing down his internet. The engineer wants the traffic to go via Path B. The engineer logs into the router and *artificially changes the metric*. They manually hardcode Path A's cost to 100. OSPF recalculates, sees that Path B (Cost 50) is now cheaper than Path A (Cost 100), and automatically detours all traffic away from the CEO's office. This is known as Traffic Engineering.

6. Equal-Cost Multi-Path (ECMP) Load Balancing

What happens if the router calculates the metrics, and Path A has a Cost of 10, and Path B also has a Cost of 10? It's a perfect tie!

The router does not arbitrarily pick a loser. It uses both! This is called Equal-Cost Multi-Path (ECMP) Load Balancing. The router installs *both* routes into the Routing Table.

  • Packet 1 arrives -> Sent down Path A.
  • Packet 2 arrives -> Sent down Path B.
  • Packet 3 arrives -> Sent down Path A.

This effectively doubles the bandwidth of your network for free, perfectly distributing the traffic load across two physical fiber cables.

7. Diagrams/Visual Suggestions

*Visual Concept: The Metric Tie-Breaker* Draw a source router and a destination router with two parallel cables connecting them. Top cable is labeled "10 Gbps Fiber (Cost: 1)". Bottom cable is labeled "10 Gbps Fiber (Cost: 1)". Show packets alternating between the top and bottom cables, illustrating the flow of ECMP Load Balancing.

8. Best Practices

  • Consistent Metric Logic: If you are running OSPF, you must ensure all routers in the enterprise use the same "Reference Bandwidth" for their math. If older routers use a 100 Mbps reference, and newer routers use a 100 Gbps reference, they will calculate completely different Cost values for the exact same physical cable, causing chaotic, unpredictable routing loops.

9. Common Mistakes

  • Asymmetric Routing: A firewall is sitting between Router A and Router B. ECMP Load balancing is turned on. Packet 1 (The TCP SYN) goes down Path A. The reply (TCP SYN-ACK) comes back down Path B. The firewall looking at Path B never saw the original request, so it thinks the reply is a hacker attack and instantly drops the packet. Load balancing across firewalls requires profound architectural care to prevent this "Asymmetric Routing" failure.

10. Mini Project: Compare OSPF vs RIP Metrics (Theory)

You have a primary route with 1 Hop over a 10 Mbps cable. You have a backup route with 4 Hops over a 10 Gbps cable.
  1. 1. Run RIP on the network. RIP looks at the Hop Count. It chooses the 1 Hop, 10 Mbps cable. The network bottlenecks and slows to a crawl.
  1. 2. Turn off RIP. Run OSPF. OSPF looks at Bandwidth. It ignores the hops and chooses the 10 Gbps cable. Data flies across the 4 routers at lightning speed.
*This theoretical exercise demonstrates why metric intelligence is critical.*

11. Practice Exercises

  1. 1. Define Equal-Cost Multi-Path (ECMP) Load Balancing and explain its benefit to enterprise bandwidth optimization.
  1. 2. Why might a network engineer artificially manipulate the OSPF Cost metric of a specific router interface?

12. MCQs with Answers

Question 1

Which specific physical characteristic of a network cable does OSPF primarily use to calculate its metric (Cost)?

Question 2

When a routing protocol calculates two distinct paths to the same destination that result in the exact same mathematical metric, what action does the router take?

13. Interview Questions

  • Q: Explain the mathematical variables used to generate routing metrics. Contrast the metric used by RIP with the metric used by OSPF.
  • Q: What is Equal-Cost Multi-Path (ECMP) routing? How does it improve network throughput?
  • Q: Describe the problem of "Asymmetric Routing" when ECMP load balancing is implemented across a Stateful Firewall.

14. FAQs

Q: Can a router load balance if the costs are NOT equal (e.g., Cost 10 and Cost 20)? A: Standard protocols like OSPF strictly cannot; they will only use the Cost 10 path. However, advanced Cisco proprietary protocols (like EIGRP) possess a highly specific feature called "Unequal-Cost Load Balancing" which can mathematically proportion traffic (e.g., sending 2/3 of traffic down the fast link, and 1/3 down the slow link).

15. Summary

In Chapter 10, we decoded the mathematics of Path Selection. We explored the variables—Bandwidth, Delay, and Reliability—that dynamic algorithms evaluate to determine the ultimate "Cost" of a route. We contrasted the blindness of Hop Count with the bandwidth-awareness of OSPF's SPF algorithm. Furthermore, we unlocked the immense power of Equal-Cost Multi-Path (ECMP) Load Balancing, proving that when metrics perfectly align, a router can multiply network throughput by utilizing redundant links simultaneously. We now possess the theoretical tools to execute complex Traffic Engineering.

16. Next Chapter Recommendation

We have mastered the rules of internal routing. But there is a massive roadblock between the internal network and the public internet. Proceed to Chapter 11: NAT and Internet Routing.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·