How a router picks between routing sources for the same prefix: administrative distance (Cisco/Arista) vs route preference (Junos/Nokia/Huawei), where it sits after longest-prefix match, the canonical Cisco defaults, a multi-vendor comparison table, floating statics, and redistribution gotchas.
When two routing sources offer a route to the same destination, which one does the router install? Administrative Distance (AD) is the tie-breaker: a per-source "trustworthiness" rank — lower is more preferred. It's a favorite interview question because the defaults are arbitrary, vendor-specific, and full of traps (eBGP beating your IGP, iBGP losing to it).
AD is local to one router, compared only between sources offering the same prefix/mask, and it comes into play after longest-prefix match. Within a single protocol, the metric breaks the tie — AD only chooses between protocols.
/32
beats an OSPF /24 for that host, regardless of AD. AD never overrides prefix length.10.0.0.0/24).The winner goes into the RIB/routing table; the losers stay in their protocol database as backups. On Cisco/Arista it's called AD; on Juniper, Nokia, and Huawei the same idea is route preference.
| Route source | AD |
|---|---|
| Connected interface | 0 |
| Static route | 1 |
| EIGRP summary route | 5 |
| External BGP (eBGP) | 20 |
| Internal EIGRP | 90 |
| IGRP | 100 |
| OSPF (internal and external) | 110 |
| IS-IS | 115 |
| RIP | 120 |
| External EIGRP | 170 |
| Internal BGP (iBGP) | 200 |
| Unknown / unreachable | 255 — never installed |
Two things interviewers press on: eBGP (20) is preferred over every IGP — an eBGP-learned prefix beats the same prefix from OSPF/IS-IS; and iBGP (200) is worse than every IGP. Also note Cisco uses 110 for both internal and external OSPF — it does not split them by AD (other vendors do).
Same concept, different defaults. Values are the vendor's default preference (lower wins):
| Route source | Cisco IOS | Arista EOS | Juniper Junos | Nokia SR OS | Huawei VRP |
|---|---|---|---|---|---|
| Connected / Direct | 0 | 0 | 0 | 0 | 0 |
| Static | 1 | 1 | 5 | 5 | 60 |
| OSPF internal | 110 | 110 | 10 | 10 | 10 |
| OSPF external | 110 | 110 | 150 | 150 | 150 |
| IS-IS (L1 / L2) | 115 | 115 | 15 / 18 | 15 / 18 | 15 |
| RIP | 120 | 120 | 100 | 100 | 100 |
| eBGP | 20 | 20 | 170 | 170 | 255 |
| iBGP | 200 | 200 | 170 | 170 | 255 |
| EIGRP (int / ext) | 90 / 170 | 90 / 170 | — | — | — |
The big cross-vendor differences to remember:
ip route ... 250) so it only installs when the dynamic route disappears — a cheap backup path.distance (globally or per-source),
Junos/Nokia/Huawei preference. Change it to steer which source wins during redistribution or migration.