Route Selection Practice: Longest Prefix, AD and Metric

Practise how a router picks a route: longest prefix first, then administrative distance, then metric. Each problem is a new routing table and packet, in Cisco IOS or Junos format, and Check my answer names the slip.

Tap the route R1 uses.

show ip route on R1show route on R1

Check your answer to see the steps.

Every route R1 has learned, before it installs one per prefix. [AD/metric] follows each prefix. Codes: C connected, L local, S static, D EIGRP, D EX external EIGRP, O OSPF, O IA OSPF inter area, R RIP, B BGP, * default.

Every route R1 has learned. [protocol/preference] follows each prefix, and a lower preference wins. Route ages and the active route marker are left out.

Practise the exams

Routing table questions show up in CCNA, ENARSI and JNCIA-Junos. Start with the free real exam questions, then get the full pack.

CCNA 200-3011,395 real exam questions · US$39
Free: 349 questionsGet the full pack
CCNP ENARSI 300-410620 real exam questions · US$39
Free: 113 questionsGet the full pack
JNCIA-Junos JN0-10698 real exam questions · US$39
Free: 24 questionsGet the full pack

Route selection FAQ

Does a lower administrative distance beat a longer prefix?

No. Administrative distance only decides which route is installed when several sources offer the same prefix. When a packet is forwarded, the longest matching prefix wins among the installed routes, so AD never overrides it. Cisco's example: with D 192.168.32.0/26, R 192.168.32.0/24 and O 192.168.32.0/19 installed, a packet to 192.168.32.1 uses the /26 and a packet to 192.168.32.100 uses the /24.

What are the default administrative distances on a Cisco router?

Connected 0, static 1, EIGRP summary route 5, external BGP 20, internal EIGRP 90, IGRP 100, OSPF 110, IS-IS 115, RIP 120, EGP 140, ODR 160, external EIGRP 170, internal BGP 200 and unknown 255. A route with AD 255 is not installed. Lower is preferred.

What are the default route preferences in Junos?

Directly connected 0, static 5, OSPF internal 10, IS-IS level 1 internal 15, IS-IS level 2 internal 18, RIP 100, aggregate 130, OSPF AS external 150 and BGP 170, among others. Junos calls administrative distance the route preference, and the lowest value becomes the active route.

When does the metric decide?

Only between paths from the same routing protocol to the same prefix. Each protocol uses its own metric, so an OSPF cost and a RIP hop count are never compared: AD decides between protocols. Within one protocol the lowest metric wins, and equal metrics share the traffic. The drill never shows an equal-cost tie.

When does a router use the default route?

Only when no more specific route matches. 0.0.0.0/0 matches every address, but its prefix length is 0, so any other match is longer. With no match and no default route, the packet is dropped. The drill assumes ip classless, where a router simply uses the longest match it can find.

How do I read [110/20] in show ip route?

The first number is the administrative distance and the second is the metric, so [110/20] is OSPF (AD 110) with a metric of 20. The letter in front is the route source: C connected, L local, S static, D EIGRP, D EX external EIGRP, O OSPF, O IA OSPF inter area, R RIP and B BGP; an asterisk marks a candidate default route.

Why does the drill show two routes for the same prefix?

It lists every route R1 has learned, so you can do the AD and metric steps yourself. On a Cisco router, show ip route only lists the route that won for each prefix. Junos show route lists every route and marks the active one with + or *, which the drill hides.

Which exam topics does this cover?

CCNA 200-301 v2.0 topic 3.1, "Interpret a routing table to identify the next hop for a packet (routing protocol, prefix/mask, administrative distance, metric, and default route)", and v1.1 topic 3.2, longest prefix match, administrative distance and routing protocol metric. ENARSI 300-410 topic 1.1 is troubleshooting administrative distance, and JNCIA-Junos covers routing tables, routing versus forwarding tables and route preference.

Sources

Checked 20 November 2026 against Cisco and Juniper documentation and RFC 1812.

More free tools

All free tools