What is the difference between administrative distance and metric?
Show the answer
Say this first
Metric ranks paths inside one routing protocol: it is advertised and grows hop by hop. Administrative distance ranks different sources of the same prefix: it is local to one router and never advertised. The router uses metric to choose the best OSPF path, then AD to choose between that OSPF route and, say, an EIGRP route to the exact same prefix.
Go deeper
| Administrative distance | Metric | |
|---|---|---|
| Compares | different sources (protocols, statics) | paths inside one protocol |
| Scope | local to the router | carried in updates, accumulates |
| Applies when | same prefix and length from two sources | always, inside the protocol |
| Shown as | first number in [110/20] | second number in [110/20] |
Example
R1 learns 10.5.0.0/24 from OSPF with cost 3 and from EIGRP with metric 3072. The numbers are not comparable. R1 installs the EIGRP route because 90 is lower than 110:
D 10.5.0.0/24 [90/3072] via 10.0.13.2, 00:02:11, GigabitEthernet0/0/2If OSPF had two paths, one with cost 3 and one with cost 5, OSPF itself would have picked cost 3 before offering anything to the RIB.
Order of decisions
- Inside each protocol: best metric.
- Between sources, for the same prefix: lowest AD.
- For each packet: longest prefix match across everything installed.
They will ask next
Two routes to the same prefix have the same AD and the same metric. What happens?
If they come from the same protocol, both are installed as equal cost paths (ECMP) up to
maximum-paths. Two different protocols with the same AD is a corner case you only get by changing defaults, and you should avoid building it.
Traps
- Saying a lower metric beats a lower AD. Metric is never compared across protocols.