NetworkingCCNA

CCNA Routing Table: Codes, AD, Metrics & Longest Prefix Match

The routing table is the decision engine of every router. The CCNA 200-301 exam presents `show ip route` output and asks you to determine where a packet will be forwarded, which route wins when multiple entries match, and what each code letter means. You need to know administrative distance (AD), metrics, longest prefix match, and how connected, static, and dynamic routes appear in the table. This guide covers all of it.

9 min
4 sections · 6 exam key points
5 practice questions

Reading show ip route output

The `show ip route` command displays the IP routing table. Each line represents a known route. The format is: Code, then network/prefix, then administrative distance/metric in brackets, then via next-hop or outgoing interface.

Example: `O 10.1.2.0/24 [110/20] via 192.168.1.1, 00:05:23, GigabitEthernet0/0` — O = OSPF route, 10.1.2.0/24 = destination network, [110/20] = AD 110 / metric 20, via 192.168.1.1 = next-hop IP, 00:05:23 = time since learned, GigabitEthernet0/0 = outgoing interface.

Common route codes: C = connected (directly attached network), L = local (the router's own interface IP as a /32 host route), S = static, O = OSPF, D = EIGRP, R = RIP, B = BGP, i = IS-IS, * = default route candidate. A route with `*` is a candidate for the default route when no more specific match exists.

Administrative distance

Administrative distance (AD) is the trustworthiness rating of a routing information source. Lower AD is more trusted. When two routing sources provide a route to the same destination, the route with the lowest AD wins and is installed in the routing table.

Key AD values to memorize: Connected = 0 (most trusted), Static = 1, EIGRP summary = 5, External BGP = 20, Internal EIGRP = 90, OSPF = 110, IS-IS = 115, RIP = 120, External EIGRP = 170, Internal BGP = 200. A directly connected route (AD 0) always beats any dynamic routing protocol's version of the same network.

AD is only used to choose between routes to the same destination from different sources. Once a source is chosen, the metric within that protocol determines the best path if multiple routes from the same protocol cover the same network.

Metrics and longest prefix match

Metric measures the cost of reaching a destination within a single routing protocol. Each protocol uses a different metric: RIP uses hop count (maximum 15); OSPF uses cumulative cost based on interface bandwidth (reference bandwidth / interface bandwidth); EIGRP uses a composite metric based on bandwidth and delay; BGP uses AS path length and various policy attributes.

When the same routing protocol has two paths to the same network, the path with the lower metric wins. Equal-cost load balancing occurs when two paths have the same metric — both are installed in the routing table and traffic is distributed across them.

Longest prefix match is how the router selects which route to use for a specific packet. The router compares the destination IP against all routing table entries and selects the entry with the longest matching prefix (most specific). A /28 route beats a /24 route beats a /0 default route, even if the /0 has better AD or metric. Specificity always wins over AD and metric.

Connected, static, and default routes

Connected routes (C) appear automatically when an interface is configured with an IP address and is in an up/up state. The router knows it can directly reach that subnet without any routing protocol. Connected routes have AD 0.

Local routes (L) are /32 host routes for the router's own interface IP addresses. They're used to efficiently identify traffic destined for the router itself (to a router's interface) rather than traffic transiting the router.

Static routes (S) are manually configured: `ip route <network> <mask> <next-hop or interface>`. A static route with a next-hop IP is a recursive static route — the router must look up the next-hop IP in the routing table. A static route with an outgoing interface is a directly connected static route. Floating static routes use a higher-than-normal AD (e.g., AD 5 for a backup to OSPF) so they only appear if the dynamic route is removed.

The default route (S* or O* etc.) matches any destination when no more specific route exists: `ip route 0.0.0.0 0.0.0.0 <next-hop>`. It appears in the routing table as 0.0.0.0/0.

Administrative distance values

SourceADNotes
Connected0Most trusted; direct interface
Static1Manually configured
EIGRP summary route5Auto-summary routes
External BGP (eBGP)20Routes from other ASes
Internal EIGRP90
OSPF110Most common IGP
IS-IS115
RIP120Hop count, max 15
External EIGRP170Routes redistributed into EIGRP
Internal BGP (iBGP)200Least trusted dynamic source

Key exam facts — CCNA

  • Lower AD = more trusted; connected (0) always beats any dynamic protocol
  • Longest prefix match always takes priority over AD and metric
  • OSPF AD = 110; EIGRP internal = 90; RIP = 120
  • C = connected, L = local (/32 host route for router's own IP), S = static, O = OSPF, D = EIGRP
  • Floating static route: set AD higher than dynamic protocol so it only activates if dynamic route disappears
  • Default route: 0.0.0.0/0 — matches anything with no more specific route

Common exam traps

The route with the best metric always wins

Longest prefix match takes absolute priority. Then AD determines which routing source wins. Metric only breaks ties within the same routing protocol. A /30 OSPF route always beats a /24 static route for a specific /30 destination.

A static route with AD 1 always overrides dynamic routes

Only if the static and dynamic routes cover the exact same network prefix. Longest prefix match is evaluated first — a more specific dynamic route wins over a less specific static route regardless of AD.

Connected routes must be configured manually

Connected routes appear automatically when a router interface is configured with an IP address and the interface is up/up. No routing protocol or manual configuration is needed.

Practice questions — Routing Table

These questions are representative of what you will see on CCNA exams. The correct answer and explanation are shown immediately below each question.

Q1.A router has two routes to 10.1.0.0/16: one from OSPF and one from RIP. Which route is installed in the routing table?

A.The RIP route, because RIP has a lower metric
B.Both routes, as equal-cost load balancing
C.The OSPF route, because OSPF has a lower AD (110) than RIP (120)
D.Neither, because conflicting routes cause a loop

Explanation: When two routing protocols provide a route to the same destination, the route with the lowest administrative distance wins. OSPF AD = 110; RIP AD = 120. The OSPF route is installed. Metric is only compared within the same protocol.

Q2.A routing table has these entries: 10.0.0.0/8 (static), 10.1.0.0/16 (OSPF), 10.1.1.0/24 (EIGRP). A packet arrives for 10.1.1.50. Which route is used?

A.10.0.0.0/8 static
B.10.1.0.0/16 OSPF
C.10.1.1.0/24 EIGRP
D.The default route

Explanation: Longest prefix match selects the most specific route. 10.1.1.0/24 has the longest prefix that matches 10.1.1.50 (/24 > /16 > /8). The protocol (EIGRP) doesn't matter — specificity wins.

Q3.Which route code in `show ip route` represents a route to the router's own interface IP address as a /32?

A.C
B.S
C.L
D.O

Explanation: L (Local) routes are /32 host routes automatically installed for the router's own interface IP addresses. C (Connected) routes represent the entire subnet of a directly attached interface.

Q4.A network engineer configures a static route with AD 200 as a backup for an OSPF route (AD 110). When will the static route appear in the routing table?

A.Always, because static routes take priority
B.Never, because the AD is invalid
C.Only when the OSPF route is removed from the routing table
D.Only when the metric exceeds 200

Explanation: This is a floating static route. With AD 200, it's less trusted than OSPF (AD 110), so the OSPF route wins and the static route is not installed. If the OSPF route disappears (link failure, neighbor loss), the static route (AD 200) is installed as a backup.

Q5.What does the entry `Gateway of last resort is 203.0.113.1 to network 0.0.0.0` indicate?

A.The router has no routing table
B.A default route (0.0.0.0/0) via 203.0.113.1 is configured
C.The router is the root bridge
D.OSPF has elected 203.0.113.1 as DR

Explanation: The 'Gateway of last resort' line shows the default route destination. 0.0.0.0/0 is the default route — it matches any destination when no more specific route exists. The router will forward unmatched packets to 203.0.113.1.

Frequently asked questions — Routing Table

What is administrative distance and why does it matter?

Administrative distance (AD) is a number from 0–255 that rates the trustworthiness of a routing information source. When multiple routing sources know a route to the same destination, the source with the lowest AD wins. Connected routes (AD 0) always beat static (AD 1) and dynamic routes. OSPF (AD 110) beats RIP (AD 120).

What is longest prefix match?

Longest prefix match is the router's rule for selecting which routing table entry applies to a packet. The route with the most specific (longest) prefix that matches the destination IP is always used, regardless of AD or metric. A /30 route always beats a /24 or /0 route for a destination that falls within all three.

What is a floating static route?

A floating static route is a static route configured with a higher-than-normal AD so it doesn't appear in the routing table while a more trusted dynamic route (lower AD) exists. If the dynamic route fails, the floating static route automatically becomes active. It's a simple backup/failover mechanism without requiring routing protocol convergence.

What is the difference between a Connected (C) and Local (L) route?

A Connected (C) route represents the entire subnet of a directly attached interface — e.g., 192.168.1.0/24. A Local (L) route is a /32 host route for the router's own interface IP — e.g., 192.168.1.1/32. Local routes help the router efficiently process traffic destined for its own interfaces.

Why does OSPF have a higher AD than EIGRP?

Cisco assigned these AD values based on general trust assessments of each protocol's convergence and reliability. EIGRP (AD 90) was considered more trustworthy than OSPF (AD 110) in Cisco's design. This doesn't mean EIGRP is always better — it means in a network running both, EIGRP routes are preferred when they cover the same destination.

Practice this topic

Test yourself on Routing Table

JT Exams routes you to questions in your exact weak areas — automatically, after every session.

No credit card · Cancel anytime

Related certification topics