What is administrative distance, and what are the default values on a Cisco router?
Show the answer
Say this first
Administrative distance is how much the router trusts a source of routing information. When two sources offer the same prefix, the lower AD is installed. It is local to the router and is never advertised. Connected 0, static 1, EIGRP summary 5, eBGP 20, EIGRP internal 90, IGRP 100, OSPF 110, IS-IS 115, RIP 120, EIGRP external 170, iBGP 200, unknown 255 (never installed).
Go deeper
The full Cisco table
| Source | AD |
|---|---|
| Connected interface | 0 |
| Static route | 1 |
| EIGRP summary (discard route on the summarizing router) | 5 |
| eBGP | 20 |
| EIGRP internal | 90 |
| IGRP (obsolete) | 100 |
| OSPF (intra-area, inter-area and external alike) | 110 |
| IS-IS | 115 |
| RIP | 120 |
| ODR (On-Demand Routing) | 160 |
| EIGRP external | 170 |
| iBGP and locally originated BGP aggregates | 200 |
Default route learned with ip address dhcp | 254 |
| Unknown or untrusted | 255 |
Details people get wrong
- A static route that names only an exit interface shows
is directly connectedin the table, but its AD is still 1.show ip routefor it saysdistance 1, metric 0 (connected). - OSPF gives the same 110 to every route type by default. You can split them with
distance ospf intra-area 110 inter-area 110 external 120. - AD 255 means the route is never installed. Setting a static route to 255 is a way to keep it in the config but out of the table.
Other vendors
Junos calls it route preference: direct 0, static 5, OSPF internal 10, IS-IS level 1 internal 15, level 2 internal 18, RIP 100, OSPF external 150, BGP 170 (the same for iBGP and eBGP). The idea is identical, the numbers are not, which matters when you mix vendors and redistribute.
They will ask next
Why is eBGP 20 but iBGP 200?
A prefix learned straight from another AS over eBGP is normally the only good way to reach it, so it should beat an IGP copy. A prefix learned over iBGP is usually internal or already known to the IGP, and the IGP knows the real path inside the AS. AD 200 makes sure the IGP route wins, which also keeps BGP next hops resolved through the IGP instead of through BGP itself.
Is the AD sent to neighbors?
No. AD is a local tie-breaker. Two routers can use different values, which is useful for a migration but can also create loops if done carelessly.
How do you change it?
Per static route with a number at the end (
ip route 0.0.0.0 0.0.0.0 198.51.100.1 250), per protocol with thedistancecommand (distance eigrp 90 170,distance bgp 20 200 200), or per source and prefix withdistance <ad> <source> <wildcard> <acl>in RIP and EIGRP.
Traps
- Saying a static route to an interface has AD 0. It is 1; it is only displayed as directly connected.
- Forgetting EIGRP external 170. It is the value behind most redistribution surprises with OSPF.
- Quoting Junos and Cisco numbers as if they were the same table.