Loading content...
If you're driving from San Francisco to Los Angeles, there are multiple routes: the scenic Pacific Coast Highway, the fast Interstate 5, or back roads through farmland. Each has different characteristics—some faster, some shorter in distance, some more reliable, some more beautiful. How do you choose?
Routers face the same fundamental challenge. Between any two points in a network, there are often multiple paths. Some have more bandwidth, some have lower latency, some traverse fewer hops, some are more reliable. The routing metric is how routers quantify these path characteristics and make optimal selections.
Metrics are the numerical language routers use to compare paths. Understanding metrics is understanding how and why your traffic takes the route it does—and how you can influence those decisions through network design and configuration.
By the end of this page, you will understand what routing metrics are, the different types of metrics used by various protocols, how metrics influence path selection, composite metrics that combine multiple factors, and how to manipulate metrics for traffic engineering.
What is a Routing Metric?
A routing metric is a numerical value that represents the quality, cost, or desirability of a particular network path. Routers use metrics to compare routes and select the best path to a destination.
A routing metric quantifies path characteristics, enabling routers to make consistent, deterministic decisions when multiple paths exist to the same destination.
Core Principles
The Role of Metrics in Path Selection
When multiple routes exist to the same destination from the same routing protocol:
Route selection process:
1. Both routes to 10.0.0.0/8 from OSPF:
Path A: Metric 50
Path B: Metric 75
2. Compare metrics (both from OSPF, same AD):
50 < 75
3. Result: Path A selected (lower metric)
4. Install Path A in FIB
Note: If Path A metric = Path B metric = 50:
→ Equal-Cost Multipath (ECMP)
→ Both paths installed and used
Administrative Distance vs. Metric
These often get confused:
| Comparison Type | Purpose | When Used |
|---|---|---|
| Administrative Distance | Which routing source to trust | Comparing routes from different protocols |
| Metric | Which path is better | Comparing routes from the same protocol |
Example: A route to 10.0.0.0/8 exists from both OSPF (AD=110) and BGP (AD=20). First, AD wins—BGP route is used. Only if there were multiple BGP routes would the BGP metric come into play.
Each routing protocol was designed for different environments with different optimization goals. RIP optimizes for simplicity (hop count). OSPF optimizes for bandwidth. EIGRP optimizes for multiple factors. BGP optimizes for policy and business relationships. No single metric works for all scenarios.
Different routing protocols use different metrics, each capturing different aspects of path quality.
Hop Count
The simplest metric: count the number of routers (hops) between source and destination.
Hop Count Metric:
Source ──[R1]──[R2]──[R3]── Destination
1 2 3
Metric = 3 (three routers traversed)
Advantages:
- Extremely simple to calculate
- Low overhead (just count hops)
- Easy to understand
Disadvantages:
- Ignores link speed (a 10Mbps hop = a 10Gbps hop)
- Ignores congestion
- Ignores reliability
- May choose longer path in miles if fewer routers
Used by: RIP (maximum 15 hops, 16 = unreachable)
| Metric Type | Measures | Units | Protocols Using It |
|---|---|---|---|
| Hop Count | Number of routers | Hops (1-15 typical) | RIP |
| Bandwidth | Link capacity | Kbps, formula-based | OSPF, EIGRP |
| Delay | Propagation + processing time | Microseconds | EIGRP |
| Cost | Abstract/configurable value | Dimensionless | OSPF, IS-IS |
| Reliability | Error rate history | Percentage or scale | EIGRP (optional) |
| Load | Current utilization | Percentage | EIGRP (optional) |
| MTU | Maximum transmission unit | Bytes | EIGRP (optional) |
| AS Path Length | Autonomous systems traversed | AS count | BGP |
Bandwidth-Based Metrics
Used by OSPF and EIGRP to prefer higher-capacity links:
OSPF Cost Formula:
Reference Bandwidth
OSPF Cost = ──────────────────────────────
Interface Bandwidth
Default reference bandwidth: 100 Mbps (10^8 bps)
Examples (default reference):
┌─────────────────────────────────────────────┐
│ Interface Speed │ Calculation │ Cost │
├─────────────────────────────────────────────┤
│ 10 Mbps │ 100/10 │ 10 │
│ 100 Mbps │ 100/100 │ 1 │
│ 1 Gbps │ 100/1000 │ 1 * │
│ 10 Gbps │ 100/10000 │ 1 * │
└─────────────────────────────────────────────┘
* Problem: All Gigabit+ links have same cost!
Solution: Increase reference bandwidth
router ospf 1
auto-cost reference-bandwidth 10000
With 10 Gbps reference:
│ 1 Gbps │ 10000/1000 │ 10 │
│ 10 Gbps │ 10000/10000 │ 1 │
Delay-Based Metrics
EIGRP includes delay in its calculation:
EIGRP Delay Component:
- Configured in tens of microseconds
- Cumulative: adds up along the path
- Reflects propagation and serialization delay
Typical delay values:
- Ethernet: 100 (1,000 microseconds)
- FastEthernet: 100 (1,000 microseconds)
- GigabitEthernet: 10 (100 microseconds)
- Serial T1: 20,000 (200,000 microseconds)
- Satellite: Very high (>500,000 microseconds)
Each major routing protocol has its own approach to metrics. Understanding these is essential for network design and troubleshooting.
RIP Metric (Hop Count)
RIP Metric Rules:
- Directly connected: Metric 1
- Each additional hop: +1
- Maximum: 15 (16 = infinity/unreachable)
- All links weighted equally regardless of speed
Example:
Network A ──[56kbps]── R1 ──[1Gbps]── R2 ──[1Gbps]── Dest
Network B ──[1Gbps]── R3 ──[1Gbps]── R4 ──[1Gbps]── R5 ──[1Gbps]── Dest
RIP chooses: Path A (3 hops) over Path B (4 hops)
Despite Path A having a 56Kbps bottleneck!
This is why RIP is rarely used today.
OSPF Metric (Cost)
OSPF Cost Calculation:
- Cost per interface based on bandwidth
- Path cost = sum of all interface costs along path
- Preference: Lower total cost wins
Path Example:
Cost: 10 Cost: 1 Cost: 1
Source ────[10Mbps]──── R1 ────[100Mbps]──── R2 ────[100Mbps]──── Dest
Cost: 1 Cost: 1
Source ────[100Mbps]──── R3 ────[100Mbps]──── Dest
Path 1 total cost: 10 + 1 + 1 = 12
Path 2 total cost: 1 + 1 = 2
OSPF chooses Path 2 (cost 2 < cost 12)
Manual Cost Override:
interface GigabitEthernet0/0
ip ospf cost 50
EIGRP Metric (Composite)
EIGRP uses a composite metric calculated from multiple path characteristics:
EIGRP Classic Metric Formula:
Metric = [K1×Bandwidth + K2×Bandwidth/(256-Load) + K3×Delay] × [K5/(Reliability+K4)]
Default K values: K1=1, K2=0, K3=1, K4=0, K5=0
Simplified (with defaults):
Metric = [Bandwidth + Delay] × 256
Where:
- Bandwidth = 10^7 / minimum_bandwidth_in_kbps
- Delay = sum of delays in tens of microseconds
Example Path:
Link 1: 100 Mbps, delay 100 (1ms)
Link 2: 10 Mbps, delay 1000 (10ms)
Bandwidth component: 10^7 / 10,000 = 1000
Delay component: 100 + 1000 = 1100
Metric = (1000 + 1100) × 256 = 537,600
All EIGRP routers in an AS must use identical K-values. Mismatched K-values prevent neighbor adjacency formation. Don't change K-values unless you understand the implications and can update all routers consistently.
BGP Metric (Multi-Factor Path Selection)
BGP doesn't use a simple numeric metric. Instead, it follows a multi-step path selection process:
BGP Best Path Selection (Simplified):
1. Highest Weight (Cisco local preference override)
2. Highest LOCAL_PREF (prefer certain exit points)
3. Locally originated routes preferred
4. Shortest AS_PATH (fewer autonomous systems)
5. Lowest ORIGIN type (IGP < EGP < Incomplete)
6. Lowest MED (Multi-Exit Discriminator)
7. eBGP over iBGP
8. Lowest IGP metric to next-hop
9. Oldest route (for stability)
10. Lowest router-id (tiebreaker)
Note: 'Metric' in BGP output typically refers to MED,
but actual path selection involves all these factors.
BGP's approach reflects its use for policy-based routing between organizations, not just finding the 'shortest' path.
Composite metrics combine multiple path characteristics into a single value. This approach provides more nuanced path selection but adds complexity.
EIGRP Wide Metrics
Classic EIGRP metrics had scaling problems with high-speed links. EIGRP Wide Metrics address this:
Problem with Classic EIGRP:
- Metric uses 32-bit arithmetic
- Very high-speed links produce same metric
- Limited differentiation above 10Gbps
EIGRP Wide Metrics (EIGRP Named Mode):
- Uses 64-bit arithmetic
- Introduces new components
- Better scaling for modern networks
Wide Metric Calculation:
Throughput Latency
Metric = ─────────────────────── × ────────────
Minimum Bandwidth K values
× Reliability × Load × Hop adjustment × Energy
New Named Mode Configuration:
router eigrp MYNET
address-family ipv4 unicast autonomous-system 100
metric rib-scale 128 ! Converts to 32-bit for RIB
IS-IS Metrics
IS-IS uses configurable costs similar to OSPF:
IS-IS Metric Types:
1. Narrow Metrics (original):
- 6-bit per link (0-63)
- 10-bit path cost (0-1023)
- Too small for modern networks
2. Wide Metrics (modern):
- 24-bit per link (0-16777215)
- 32-bit path cost (0-4294967295)
- Required for any serious deployment
Configuration:
interface GigabitEthernet0/0
isis metric 1000
router isis
metric-style wide
| Protocol | Formula | Components | Range |
|---|---|---|---|
| RIP | Hop count | Hops only | 1-15 |
| OSPF | Reference BW / Interface BW | Bandwidth | 1-65535 per link |
| EIGRP Classic | (BW + Delay) × 256 | Bandwidth, Delay | 0-4294967295 |
| EIGRP Wide | Throughput × Latency × K factors | BW, Delay, Reliability, Load | 64-bit |
| IS-IS Narrow | Sum of link costs | Configurable cost | 0-1023 total |
| IS-IS Wide | Sum of link costs | Configurable cost | 0-4294967295 |
| BGP | Multi-attribute comparison | AS-Path, LOCAL_PREF, MED, etc. | N/A |
Hop count (RIP) is for simple networks only. Cost-based (OSPF, IS-IS) works well when bandwidth is the primary concern. Composite (EIGRP) is best when multiple factors matter. Policy-based (BGP) is for inter-organization routing where business relationships override technical metrics.
Network engineers often need to influence path selection for policy or performance reasons. Metric manipulation is a primary tool for this.
OSPF Cost Manipulation
Scenario: Force traffic away from a specific link
Before:
R1 ──[Cost 10]── R2 ──[Cost 10]── Dest = Total 20
R1 ──[Cost 10]── R3 ──[Cost 10]── Dest = Total 20 (ECMP)
Goal: Prefer path through R2, use R3 as backup
Solution 1: Increase cost on R3 path
On R1 or R3:
interface GigabitEthernet0/1 ! Link to R3
ip ospf cost 100
After:
R1 ──[Cost 10]── R2 ──[Cost 10]── Dest = Total 20 ✓
R1 ──[Cost 100]── R3 ──[Cost 10]── Dest = Total 110 (backup)
Solution 2: Decrease cost on preferred path
On R1 or R2:
interface GigabitEthernet0/0 ! Link to R2
ip ospf cost 1
After:
R1 ──[Cost 1]── R2 ──[Cost 10]── Dest = Total 11 ✓
R1 ──[Cost 10]── R3 ──[Cost 10]── Dest = Total 20 (backup)
EIGRP Offset List
Offset lists add to or subtract from EIGRP metrics:
! Add 1000 to metric for routes learned from 10.1.1.1
access-list 1 permit 10.0.0.0 0.255.255.255
router eigrp 100
offset-list 1 in 1000 GigabitEthernet0/0
Effect:
- Routes matching ACL 1 (10.0.0.0/8)
- Received on Gi0/0
- Have 1000 added to their metric
- Makes them less preferred than other paths
BGP LOCAL_PREF for Outbound Traffic
! Prefer ISP1 over ISP2 for all outbound traffic
route-map PREFER_ISP1 permit 10
set local-preference 200
route-map PREFER_ISP2 permit 10
set local-preference 100 ! Lower = less preferred
router bgp 65000
neighbor 10.1.1.1 route-map PREFER_ISP1 in ! ISP1
neighbor 10.2.2.2 route-map PREFER_ISP2 in ! ISP2
Result:
- Routes from ISP1: LOCAL_PREF 200 (preferred)
- Routes from ISP2: LOCAL_PREF 100 (backup)
- All outbound traffic exits via ISP1
Careless metric manipulation can create routing loops, especially when changes are made asymmetrically. Always verify routing tables and test traffic flows after metric changes. Use traceroute to confirm actual paths match expectations.
One of the most challenging aspects of multi-protocol networks is that metrics from different protocols are not directly comparable.
The Incomparability Problem
Scenario:
Route to 10.0.0.0/8 from OSPF: Metric 100
Route to 10.0.0.0/8 from EIGRP: Metric 2816000
Route to 10.0.0.0/8 from BGP: Metric 0 (MED)
Question: Which has the 'best' metric?
Answer: IMPOSSIBLE to compare directly!
- OSPF 100 = Sum of bandwidth-inverse costs
- EIGRP 2816000 = Composite of many factors
- BGP 0 = MED hint (not even primary selection criteria)
The numbers mean completely different things.
Route Redistribution Metric Assignment
When redistributing between protocols, you must assign a metric in the destination protocol's terms:
! Redistributing OSPF into EIGRP
router eigrp 100
redistribute ospf 1 metric 10000 1000 255 1 1500
│ │ │ │ │
│ │ │ │ └─ MTU (bytes)
│ │ │ └─ Load (1-255)
│ │ └─ Reliability (0-255)
│ └─ Delay (in tens of μs)
└─ Bandwidth (Kbps)
! Redistributing EIGRP into OSPF
router ospf 1
redistribute eigrp 100 subnets metric 100 metric-type 1
│
└─ OSPF cost (single number)
The original EIGRP composite metric is lost;
a single OSPF cost must be chosen by the engineer.
Default Redistribution Metrics
Some protocols have default redistribution metrics:
| Source Protocol | Into OSPF | Into EIGRP | Into RIP |
|---|---|---|---|
| Connected | 20 | Infinite (won't install) | 1 |
| Static | 1 | Infinite | 1 |
| OSPF | N/A | Infinite | N/A |
| EIGRP | 20 | N/A | 1 |
| BGP | 1 | Infinite | 1 |
Important: 'Infinite' in EIGRP redistribution means routes won't be redistributed unless you explicitly set a metric!
Always explicitly set metrics when redistributing. Document what metric you chose and why. Consider using route-maps to set different metrics for different prefixes based on their original characteristics. The redistribution point is where institutional knowledge meets configuration.
In production networks, metric decisions must consider factors beyond protocol specifications.
Metric Stability vs. Accuracy
Should metrics reflect real-time conditions?
Load-Sensitive Routing (Using EIGRP K2):
Pros:
- Routes adapt to congestion
- Optimal path changes as load changes
- Maximum bandwidth utilization
Cons:
- Route instability (constant recalculation)
- Oscillation (traffic moves, load moves, traffic moves back)
- CPU overhead for metric calculation
- Convergence delays
Industry consensus: DO NOT use load in metrics
- Default EIGRP: K2=0 (load ignored)
- Default EIGRP: K4=0, K5=0 (reliability ignored)
- Only bandwidth and delay are typically used
Metric Scheme Design Example
Enterprise Campus OSPF Metric Scheme:
Goal: Prefer faster links, provide predictable failover
Reference bandwidth: 100 Gbps (100000)
router ospf 1
auto-cost reference-bandwidth 100000
Resulting costs:
┌──────────────────────────────────────────────┐
│ Link Type │ Speed │ OSPF Cost │
├──────────────────────────────────────────────┤
│ Core-to-Core │ 100 Gbps │ 1 │
│ Core-to-Dist │ 40 Gbps │ 2-3 │
│ Dist-to-Access │ 10 Gbps │ 10 │
│ Access-to-Server │ 1 Gbps │ 100 │
│ Management │ 100 Mbps │ 1000 │
│ Out-of-band backup │ 10 Mbps │ 10000 │
└──────────────────────────────────────────────┘
Traffic behavior:
- Normal: Fast links used (cost 1-100)
- If Core link fails: Traffic reroutes via alternate core (same cost)
- If Dist link fails: Traffic uses parallel Dist link or routes via Access
- Only extreme failure: OOB management network (cost 10000) used
Link Aggregation Considerations
Problem:
Single 10GbE: Cost 10
4x10GbE LAG: OSPF cost still 10 (just sees one interface)
But LAG provides 4x bandwidth!
Solutions:
1. Manual cost adjustment:
interface Port-channel1
ip ospf cost 3 ! (10/4 ≈ 3, reflecting 4x capacity)
2. OSPF cost based on aggregate bandwidth:
Some platforms automatically calculate LAG bandwidth
Check: show interface port-channel1 | include BW
3. Accept the limitation:
If both 10GbE and LAG are alternatives, LAG will be
preferred due to ECMP across member links, even if
OSPF cost is same
Your metric scheme determines failover behavior. If primary and backup paths have similar metrics, minor failures cause traffic shifts. If backup paths have much higher metrics, they're only used for major failures. Design your metrics to match your capacity planning and SLA requirements.
Routing metrics are the quantitative language routers use to compare paths. Let's consolidate what we've learned:
Module Complete
You've now completed the comprehensive exploration of Routing Concepts. You understand:
These foundational concepts underpin all routing protocols and algorithms. Every decision an OSPF router makes, every BGP path selection, every EIGRP feasibility calculation builds on these fundamentals.
Congratulations! You've mastered the fundamental concepts of routing. You now understand how routers determine optimal paths through networks—knowledge essential for designing, implementing, and troubleshooting any network. Next modules will explore specific routing protocols and advanced algorithms.