Two different questions
Once longest prefix match (previous topic) has narrowed things down to routes for the exact same destination network, a router can still end up with more than one candidate: maybe a static route and an OSPF (Open Shortest Path First) route both claim to know how to reach 10.0.2.0/24. Two separate numbers resolve that, each answering a different question:
- Administrative Distance (AD): "Which source of routing information do I trust more?" Lower wins. This only matters when routes for the same destination come from different protocols or origins.
- Metric: "Which specific path does this one protocol think is best?" Only compared between routes learned from the same protocol. RIP's (Routing Information Protocol) hop count isn't comparable to OSPF's cost, they're different units entirely.
It's the difference between picking which map app to trust when two apps disagree about the best route, versus that one app's own opinion of which of its own suggested routes is fastest.
| Source | Default Administrative Distance |
|---|---|
| Directly connected | 0 |
| Static route | 1 |
| eBGP | 20 |
| EIGRP (internal) | 90 |
| OSPF | 110 |
| RIP | 120 |
| iBGP | 200 |
Using AD on purpose: The floating static route
Because a lower AD always wins, you can deliberately configure a static route with a higher AD than your dynamic protocol, so it sits unused and ignored under normal conditions. If the dynamic route ever disappears (a link fails, the protocol stops advertising it), that static route "floats" up into use automatically as a backup path, no manual intervention required.
Mixing up AD and metric leads to confusing troubleshooting: seeing a static route (AD 1) silently override an OSPF route (AD 110) to the same destination looks like a bug until you remember AD picks the trusted source first. The metric never even gets compared in that case.