Cisco CCNA guideStudy & preparation
CCNA Routing Table: Find the Next Hop With Longest Match, Administrative Distance and Metric
Read a Cisco routing table the way CCNA v2.0 objective 3.1 asks: route codes, the [distance/metric] brackets, longest prefix match, the default route, and the four static route types in IPv4 and IPv6.
Short answer
To find the next hop, list every installed route whose prefix contains the destination address, then pick the longest prefix: a /25 beats a /24, which beats the default route. Administrative distance and metric don't compete with prefix length. Earlier, they decided which route for the same prefix was installed: lower distance between sources (connected 0, static 1, OSPF 110), then lower metric within one protocol. In show ip route, the brackets read [administrative distance/metric]. A floating static route has a higher distance than the main route, so it is installed only when the main route disappears.
Routing-table questions look like reading tests, but they are really ordering tests. Candidates who know every route code still miss them by applying administrative distance where prefix length decides, or the other way around. Cisco's own documentation separates the two steps clearly, and once you keep them apart, each question becomes a short, repeatable procedure.
What CCNA objectives 3.1 and 3.2 ask about the routing table
The v2.0 exam topics, which apply from February 3, 2027, include:
- 3.1 Interpret a routing table to identify the next hop for a packet: routing protocol, prefix and mask, administrative distance, metric and default route
- 3.2 Troubleshoot IPv4 and IPv6 static routing: default, network, host and floating static routes
The v1.1 outline, in use through February 2, 2027, covers the same ground in three objectives: 3.1 (routing table components), 3.2 (how a router makes a forwarding decision: longest prefix match, administrative distance, metric) and 3.3 (configure and verify static routes). The skill is the same in both versions. v2.0 frames static routing as troubleshooting.
Reading a show ip route entry, field by field
Here is a simplified routing table for a router called R1. It was written by Passy for this guide; it isn't Cisco output. R1 has four interfaces: G0/0 to the internet provider and G0/1, G0/2 and G0/3 to three other routers.
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, 9 subnets, 5 masks
O 10.1.0.0/16 [110/3] via 10.255.0.2, 00:14:09, GigabitEthernet0/1
O 10.1.20.0/24 [110/2] via 10.255.0.6, 00:14:09, GigabitEthernet0/2
S 10.1.20.128/25 [1/0] via 10.255.0.10
C 10.255.0.0/30 is directly connected, GigabitEthernet0/1
L 10.255.0.1/32 is directly connected, GigabitEthernet0/1
C 10.255.0.4/30 is directly connected, GigabitEthernet0/2
L 10.255.0.5/32 is directly connected, GigabitEthernet0/2
C 10.255.0.8/30 is directly connected, GigabitEthernet0/3
L 10.255.0.9/32 is directly connected, GigabitEthernet0/3
203.0.113.0/24 is variably subnetted, 2 subnets, 2 masks
C 203.0.113.0/30 is directly connected, GigabitEthernet0/0
L 203.0.113.2/32 is directly connected, GigabitEthernet0/0
What each part means:
- The code at the start says where the route came from: C connected, L local (the router's own address, as a /32), S static, O OSPF. The asterisk in S* marks a candidate default route, here a static default.
- Prefix and mask: 10.1.20.0/24 covers 10.1.20.0 to 10.1.20.255. Reading these ranges fast is subnetting, covered in the CCNA subnetting guide.
- The brackets: Cisco's administrative distance document, updated July 20, 2026, explains that the values in brackets use the format [administrative distance/metric]. [110/3] is an OSPF route with a cost of 3. [1/0] is a static route.
- "via" gives the next-hop address. For OSPF routes, the line also shows how long ago the route was learned and the exit interface.
- "Gateway of last resort" names the default route's next hop. If it reads "is not set," packets with no matching route are dropped.
How a Cisco router picks the next hop: install first, then match
The v1.1 outline names longest prefix match, administrative distance and metric in that order, and some study sites turn the three into one ranked checklist. Cisco's document describes two separate stages, and keeping them apart is what CCNA questions test.
Stage 1: which routes get installed. Each routing protocol picks its best path by its own metric. If several sources offer the same prefix with the same length, the routing table installs the one with the lowest administrative distance. A route also has to be usable: Cisco says that if the next hop can't be resolved, the route isn't installed. Cisco's default distances include:
| Route source | Default administrative distance |
|---|---|
| Connected | 0 |
| Static | 1 |
| External BGP | 20 |
| Internal EIGRP | 90 |
| OSPF | 110 |
| RIP | 120 |
| External EIGRP | 170 |
| Internal BGP | 200 |
| Unknown | 255 (never installed) |
Stage 2: which installed route forwards the packet. For each packet, the router looks at every installed route that contains the destination and uses the most specific one: the longest prefix match. Cisco's note is explicit: administrative distance and metrics aren't evaluated during forwarding, so administrative distance does not override longest prefix match. The default route, 0.0.0.0/0, matches everything, so it wins only when nothing longer does.
Worked next-hop examples from one routing table
All examples use R1's table above. They are original, written by Passy, and not taken from any Cisco exam.
| Destination | Installed routes that contain it | Longest match | R1 sends it to |
|---|---|---|---|
| 10.1.20.200 | 10.1.0.0/16, 10.1.20.0/24, 10.1.20.128/25, 0.0.0.0/0 | /25 (static) | 10.255.0.10 on G0/3 |
| 10.1.20.37 | 10.1.0.0/16, 10.1.20.0/24, 0.0.0.0/0 | /24 (OSPF) | 10.255.0.6 on G0/2 |
| 10.1.99.5 | 10.1.0.0/16, 0.0.0.0/0 | /16 (OSPF) | 10.255.0.2 on G0/1 |
| 10.2.0.1 | 0.0.0.0/0 only | /0 (default) | 203.0.113.1 on G0/0 |
| 10.255.0.6 | 10.255.0.4/30, 0.0.0.0/0 | /30 (connected) | Delivered directly on G0/2 |
Two details decide these rows. 10.1.20.37 is not in 10.1.20.128/25, which starts at .128, so the /25 doesn't apply. And for 10.1.20.200, the static /25 wins because it is longer, not because static routes have a lower distance than OSPF.
Where administrative distance does decide: suppose OSPF also learns 10.1.20.128/25 with [110/4] via 10.255.0.6. Now two sources offer the same /25. The static route (distance 1) is installed and the OSPF /25 isn't. If an engineer removes the static route, the OSPF /25 is installed in its place.
Explanations that walk through each range check help this stick, and routing math is worked step by step in the CCNA prep planned for launch.
The four static routes CCNA v2.0 names
Objective 3.2 names default, network, host and floating static routes, for IPv4 and IPv6. Original examples written by Passy:
| Type | IPv4 example | IPv6 example |
|---|---|---|
| Network | ip route 172.16.50.0 255.255.255.0 10.255.0.2 | ipv6 route 2001:db8:50::/64 2001:db8:ffff:1::2 |
| Host | ip route 172.16.50.10 255.255.255.255 10.255.0.6 | ipv6 route 2001:db8:50::10/128 2001:db8:ffff:2::2 |
| Default | ip route 0.0.0.0 0.0.0.0 203.0.113.1 | ipv6 route ::/0 2001:db8:ffff:9::1 |
| Floating | ip route 172.16.50.0 255.255.255.0 10.255.0.10 250 | ipv6 route 2001:db8:50::/64 2001:db8:ffff:3::2 200 |
How the floating route works, per Cisco's document: it is configured with an administrative distance higher than the primary route, so it stays out of the routing table while the primary exists. Cisco's own example uses distance 250 behind an OSPF route at 110. When the OSPF route disappears, the floating route is installed. The distance has to be higher than the primary's and lower than 255, because a route at 255 is never installed.
Two IPv6 notes: the router needs ipv6 unicast-routing before it routes IPv6 at all, and a static route whose next hop is a link-local address (FE80::) must also name the exit interface, as in ipv6 route ::/0 GigabitEthernet0/0 FE80::1.
Troubleshooting static routes that don't behave
Symptoms and the usual causes, from Passy's reading of objective 3.2:
- The route isn't in the table at all. The next hop can't be resolved through any route in the table, so Cisco's installation check rejects it. Check
show ip route static, the next-hop address itself and the interface toward it. - The backup route carries traffic all the time. The floating route's distance is lower than the primary's: 1 by default, or a value like 100 behind OSPF's 110.
- The backup never takes over. Its distance is 255, or its own next hop goes through the failed link.
- Traffic reaches the far network but replies never come back. The far router has no route back. Static routing needs routes in both directions.
- Only part of a range works. The mask is wrong: 255.255.0.0 where 255.255.255.0 was intended, or the reverse, so the route covers more or less than planned.
To see which route a specific destination uses, show ip route 172.16.50.10 prints the matching entry with its source, distance and metric. Then confirm the path with ping and traceroute, which objective 2.4 names alongside show commands. When a symptom still doesn't make sense, you'll be able to ask AI Rescue, planned for launch, for a fresh practice question on the same idea.
Practicing CCNA routing-table questions
The 20 free CCNA practice questions include a longest-match item and a floating-static item, each with a worked explanation. To go further:
- Build your own tables. Write five routes with overlapping prefixes, pick ten destinations, and predict the next hop before checking with
show ip routein a lab. - Change one thing at a time. Add an OSPF route for the same prefix as a static route and predict which one is installed.
- Break a floating route on purpose. Set its distance below the primary's and watch traffic move.
The CCNA OSPF guide covers where the O routes come from. For a wider set of items, the IP Routing questions planned for launch number 160 of the 800. Checkout isn't open yet.
Trust the source
Official sources
Exam policies can change. Use these primary sources for the most current details.