Administrative distance and the routing table

Updated October 9, 2026

The lookup order in one paragraph

A router chooses a route in two separate steps. First, for each destination prefix it keeps only the best source: if several routing sources offer the same prefix and mask, the one with the lowest administrative distance (AD) is installed in the routing table, and the metric only breaks ties inside one protocol. Second, when a packet arrives, the router forwards it using the longest prefix match among the installed routes. The decision rule for exam questions: find the most specific prefix that contains the destination address, and only if two sources offer that exact prefix compare AD, then metric. AD never overrides a longer prefix.

What AD is and is not

AD is a number from 0 to 255 that expresses how much the router trusts a routing source. Lower is better, and 255 means “do not install”. It is local to the router: it is not advertised to neighbors, and it can be changed per protocol or per static route. Cisco documents these defaults (Cisco: what is administrative distance):

SourceDefault AD
Connected interface0
Static route1
External BGP20
Internal EIGRP90
OSPF110
IS-IS115
RIP120
External EIGRP170
Internal BGP200
Unknown or unusable source255

The reason for AD is that metrics from different protocols cannot be compared. OSPF counts cost, RIP counts hops and EIGRP combines bandwidth and delay, so a metric of 20 means something different in each. AD gives the router a neutral rule for the case where two protocols both claim the same prefix, which typically happens during a migration or when a static route backs up a dynamic one.

Reading a routing table line by line

Here is an illustrative show ip route from router R1:

R1# show ip route
Codes: C - connected, S - static, O - OSPF, D - EIGRP, B - BGP
Gateway of last resort is 203.0.113.1 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 203.0.113.1
      10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
O        10.1.0.0/16 [110/20] via 192.168.12.2, 00:10:03, GigabitEthernet0/1
D        10.1.1.64/26 [90/3072] via 192.168.13.3, 00:05:10, GigabitEthernet0/2
S        10.1.1.0/24 [1/0] via 192.168.12.2
C        10.9.9.0/24 is directly connected, GigabitEthernet0/3

Each route line holds the same pieces, and the CCNA objectives name them: the routing protocol code at the left, the prefix and mask, the bracket [AD/metric], the next hop after via, and the exit interface. The * on the first line marks the candidate default, and the line above it, gateway of last resort, tells you where traffic goes when nothing more specific matches.

Now forward four packets, working from the destination address:

DestinationMatching routesWinner and why
10.1.1.77/0, /16, /24, /2610.1.1.64/26 via EIGRP. The /26 covers .64 to .127, and it is the longest match, even though its AD of 90 is worse than the static route’s 1
10.1.1.200/0, /16, /2410.1.1.0/24 static. .200 is outside the /26, so the /24 is the longest match
10.1.2.5/0, /1610.1.0.0/16 via OSPF
8.8.8.8/0 onlyThe default route to 203.0.113.1

Nothing in that table needed AD, because no two sources offered the same prefix. AD would matter if OSPF also advertised 10.1.1.0/24: the OSPF route (110) would lose to the static route (1), and the router would never install it.

Floating static routes and changing AD

Because a static route defaults to AD 1, it normally beats every dynamic protocol. To make a static route a backup, give it an AD higher than the primary source. With OSPF as the primary path (110), this IOS command installs a backup default route that stays out of the table until the OSPF route disappears:

ip route 0.0.0.0 0.0.0.0 198.51.100.1 130

The trailing number is the AD. The route “floats” into the table when the better one is withdrawn. Two details cause lost points: the AD must be strictly higher than the primary (equal values do not make a backup), and it must stay at or below 254, because 255 is never installed. You can also change a protocol’s distance for its own routes, for example with distance under the routing process, but the exam focus is the static case. See static vs dynamic routing for when to prefer each.

Which exams test this

ExamHow the topic appearsWhere on this site
CCNA 200-301v1.1 (until Feb 2, 2027): IP Connectivity (25%), 3.1 interpret the routing table (protocol code, prefix, mask, next hop, AD, metric, gateway of last resort) and 3.2 how a router forwards by default (longest prefix match, AD, metric). v2.0 (from Feb 3, 2027): IP Routing (20%), 3.1 interpret a routing table to identify the next hopIP routing explained
CompTIA Network+ N10-009Network Implementation (20%), 2.1 route selection by administrative distance, prefix length and metric; Network Troubleshooting (24%), 5.3 route selection, routing table and default routesImplementation (20%)

Network+ expects you to recognise the three selection criteria; CCNA expects you to apply them to pasted output. The cross-exam comparison is in CCNA vs Network+.

How exam questions are built around AD

The most frequent trap is applying AD first. A question lists a static /24 and a dynamic /26 and asks where a packet goes; candidates see “static = 1” and pick the static route. Always do the prefix match first. The second trap is the reverse: two routes to the identical prefix and mask, where prefix length no longer separates them and AD does. A third is comparing metrics across protocols, such as OSPF cost against RIP hops; the correct answer is that you cannot, AD decides.

Constraint words to watch: “backup” or “only if the primary fails” points to a floating static route with a higher AD; “most specific” or “longest” points to prefix length; “same prefix learned from two protocols” points to AD; “which protocol is more trusted” points to the lowest number. Note that iBGP at 200 is less trusted than OSPF, while eBGP at 20 is more trusted than any IGP, a favourite memorisation check. Subnet arithmetic decides whether an address falls inside a prefix, so practise it in subnetting step by step, and see OSPF explained for how a metric is calculated within one protocol.

Two practice questions

Question 1. A router has a static route to 172.16.8.0/22 (AD 1) and an EIGRP route to 172.16.10.0/24 (AD 90). Which route does the router use for a packet to 172.16.10.40?

  • A. The static route, because its AD is lower
  • B. The EIGRP route, because its prefix is longer
  • C. Both routes in a load-balanced pair
  • D. Neither route; the packet is dropped
Show answer

Answer: B

Forwarding uses the longest prefix match. 172.16.10.40 is inside both routes, because the /22 covers 172.16.8.0 to 172.16.11.255, but the /24 is more specific, so the EIGRP route is used. AD only chooses between routes to the same prefix and mask, so the static route’s lower AD does not apply. The default route is not in the table, and the router does not load balance across different prefix lengths.

Question 2. R1 learns 192.0.2.0/24 from RIP, from OSPF and from external BGP. All three are installed as candidates with default settings. Which source ends up in the routing table?

  • A. RIP, because it has the lowest hop count
  • B. OSPF, because it has the lowest cost
  • C. External BGP, because it has the lowest AD
  • D. All three, as equal-cost paths
Show answer

Answer: C

All three offer the identical prefix and mask, so the lowest administrative distance wins. External BGP has AD 20, OSPF 110 and RIP 120, so BGP is installed. The metrics cannot be compared across protocols, and the lowest metric is therefore not the selection rule. Prefix length is the same for all three, so it does not decide.

Go deeper