Network Bytes · Episode 44 · CCNA 3.2
Administrative distance
When a router learns the same network from more than one source, it trusts the one with the lowest administrative distance and puts that route in its routing table. The other route waits as a backup.
Who do you believe?
Imagine asking for directions. You can see the place yourself, your boss left a written note, and a coworker passed on a tip. If they disagree, you go with the source you trust most. A router has the same problem: it can hear about one network from several places, and it needs a rule for which one to believe.
One network, many sources
A router can learn a network in three broad ways. It's directly connected (one of its own interfaces is in that network). Someone typed it in by hand as a static route. Or a routing protocol such as OSPF, EIGRP or RIP shared it from a neighbor router. It's normal for the same prefix, say 10.2.0.0/16, to show up from more than one of these at once.
The trust score: administrative distance
Each source gets a number from 0 to 255, and lower means more trusted. Cisco's defaults:
| Route source | Default AD | |---|---| | Directly connected | 0 | | Static route | 1 | | eBGP | 20 | | EIGRP (internal) | 90 | | OSPF | 110 | | IS-IS | 115 | | RIP | 120 | | EIGRP (external) | 170 | | iBGP | 200 | | Unknown / never trusted | 255 |
A route with AD 255 is never put in the routing table.
Lowest wins, the loser waits
When two sources offer the same network, the router installs the one with the lowest AD in its routing table. A static route (AD 1) for 10.2.0.0/16 beats an OSPF route (AD 110) for the same prefix. The losing route isn't thrown away: it stays in its own protocol's database (or in the config), and if the winner disappears, the router installs it instead. That's the idea behind a floating static route: a static route given a higher AD on purpose, so it only takes over when the dynamic route is gone.
Try it yourself
In Cisco Packet Tracer (free with a Cisco Networking Academy account), configure OSPF between two routers, then on one router run show ip route and find a learned network: the brackets show [110/2], which is the AD and then the metric. Now add a static route for the same network with ip route <network> <mask> <next hop> and run show ip route again. The entry changes to an S with [1/0]. Remove the static route and watch the OSPF route come back.
Good to know
- Cisco default administrative distances: connected 0, static 1, eBGP 20, internal EIGRP 90, OSPF 110, IS-IS 115, RIP 120, external EIGRP 170, iBGP 200; 255 means never trusted and is not installed.
- AD is local to the router: it isn't sent to neighbors, and you can change it on one router without affecting others.
- AD only compares routes for the exact same prefix and length. Between different prefixes, longest prefix match (EP43) still decides where a packet goes.
- Within one routing protocol, the metric breaks ties; AD is for choosing between different sources.
- "Waits in the wings" is simplified: the losing route stays in its own protocol's database (or the config) and is installed if the winner is withdrawn, which is how floating static routes work.
For CCNA learners
This lines up with CCNA 200-301 exam topic 3.2.b, administrative distance: know the default AD values (especially connected 0, static 1, EIGRP 90, OSPF 110, RIP 120) and that the lowest AD wins when sources offer the same prefix.
Answer to the comment question
OSPF. Its administrative distance is 110 and RIP's is 120. Lower means more trusted, so the router puts the OSPF route in its routing table. The RIP route waits as a backup and is installed only if the OSPF route goes away.
Test your knowledge
Quick quiz: Administrative distance
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- Cisco, "Understand Administrative Distance": the default AD table (connected 0, static 1, eBGP 20, internal EIGRP 90, OSPF 110, IS-IS 115, RIP 120, unknown 255); lower is preferred; AD is local to the router
- Cisco, "Configure Route Selection for Routers": AD decides between routes to the same prefix from different sources; the metric only compares routes within one protocol
- Cisco, "Configure ISP Failover with Default Routes Using IP SLA Tracking": a backup route with a higher AD is installed when the preferred one is removed
- Cisco, CCNA 200-301 v1.1 exam topics: 3.2.b administrative distance
Video transcript
When two sources disagree about a route, which one does the router trust?
Imagine asking for directions. You can see the place yourself. Your boss left a written note. A coworker passed on a tip. Who do you believe?
Routers face the same problem. A router can learn one network several ways: it's plugged in, someone typed it in, or a routing protocol shared it.
Each source gets a trust score called administrative distance. Lower means more trusted. Directly connected is 0. Static, typed by hand, is 1. OSPF is 110.
When two sources offer the same network, the lowest score wins and goes into the routing table. The loser waits in the wings, ready if the winner disappears.
OSPF, at 110, and RIP, at 120, both offer the same network. Which one wins? Comment your answer below!
That's your byte.
More from Network Bytes
- EP42Reading a routing table
- EP43Longest prefix match
- EP45Static and default routes
- EP46OSPF in 60 seconds