← Interview Prep

Administrative Distance — Route Preference

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.

Where AD sits in route selection

  1. Longest-prefix match first. A more specific route always wins — a RIP /32 beats an OSPF /24 for that host, regardless of AD. AD never overrides prefix length.
  2. Then AD decides between sources for the same prefix (e.g. OSPF vs eBGP both offering 10.0.0.0/24).
  3. Then the metric (cost, hop count, etc.) decides within that winning protocol.

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.

Cisco — the canonical defaults

Route sourceAD
Connected interface0
Static route1
EIGRP summary route5
External BGP (eBGP)20
Internal EIGRP90
IGRP100
OSPF (internal and external)110
IS-IS115
RIP120
External EIGRP170
Internal BGP (iBGP)200
Unknown / unreachable255 — 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).

Multi-vendor comparison

Same concept, different defaults. Values are the vendor's default preference (lower wins):

Route sourceCisco IOSArista EOSJuniper JunosNokia SR OSHuawei VRP
Connected / Direct00000
Static115560
OSPF internal110110101010
OSPF external110110150150150
IS-IS (L1 / L2)11511515 / 1815 / 1815
RIP120120100100100
eBGP2020170170255
iBGP200200170170255
EIGRP (int / ext)90 / 17090 / 170

The big cross-vendor differences to remember:

Using & changing it

Likely interview questions

Related: OSI Model · BGP · OSPF · Junos Routing Troubleshooting.