Routing Tables & Forwarding Decisions

CCNA 200-301 · IP Connectivity

By Abu Anns · Last updated 20 November 2026Exam version: 200-301 v1.1 (current until 2 Feb 2027)

Routing is the heart of the CCNA and the biggest domain on the exam. Everything in this guide comes back to one question a router asks about every packet: given several possible ways to reach this destination, which one do I use? The answer follows strict rules, in a strict order, and the exam tests those rules relentlessly — through routing table output, through scenarios with competing routes, and through troubleshooting questions where the wrong route wins. Learn the decision order cold, and the routing questions become mechanical.

Reading the routing table

The routing table is the router's map. Each entry has a routing protocol code telling you where the route came from: C for connected, L for local (the router's own interface address), S for static, O for OSPF, D for EIGRP, and R for RIP. The entry also shows the prefix (the destination network) and its network mask, the next hop (the IP address of the next router along the path, or the outgoing interface for a directly connected network), the administrative distance (AD), and the metric. A typical line looks like this: O 10.1.1.0/24 [110/2] via 192.168.1.2, 00:05:00, GigabitEthernet0/0. Read it as: OSPF learned the network 10.1.1.0/24, with an administrative distance of 110 and a metric (cost) of 2, reachable via the next hop 192.168.1.2 out of GigabitEthernet0/0, and the route has been in the table for 5 minutes. The numbers in square brackets are always [administrative distance/metric], in that order.

The gateway of last resort is the default route, 0.0.0.0/0: the route a packet takes when no more specific route matches. show ip route announces it at the top of the output — "Gateway of last resort is 192.168.1.2 to network 0.0.0.0" — and it is the route that lets a router forward traffic to the internet without knowing every network in the world. A router with no matching route and no default route drops the packet and sends an ICMP destination unreachable message back to the sender.

How a router chooses a route

The forwarding decision follows three rules, in this exact order. First, longest prefix match: the router uses the most specific route — the one with the longest matching prefix. If the table has 10.0.0.0/8, 10.1.0.0/16, and 10.1.1.0/24, a packet for 10.1.1.50 matches all three, but the router uses the /24 because it is the most specific. Longest prefix match always wins, regardless of administrative distance or metric — a static /8 never beats an OSPF /24 for a destination inside that /24. This is the most-tested routing rule on the exam, and the most common source of wrong answers from candidates who jump straight to comparing AD values.

Second, administrative distance: when two routes to the same destination have the same prefix length, the router prefers the one with the lowest AD. AD measures how trustworthy the source of the route is: connected routes are 0, static routes are 1, EIGRP internal routes are 90, OSPF routes are 110, and RIP routes are 120. So if a router learns 10.1.1.0/24 from both OSPF (AD 110) and RIP (AD 120), it installs the OSPF route and ignores the RIP route. The losing route does not appear in the routing table at all — only the winner is installed. Memorise the AD table; the exam tests it directly, and it is also the key to understanding floating static routes in the next guide.

Third, metric: when two routes to the same destination have the same prefix length and the same AD — which normally means they came from the same routing protocol — the router compares the metric, and the lowest metric wins. For OSPF the metric is cost, based on bandwidth; for RIP it is hop count; for EIGRP it is a composite of bandwidth and delay. If the metrics are also equal, the router installs both routes and load-balances between them, sending some packets down each path.

Worked example

A router has these routes to reach 172.16.5.10: a static route to 172.16.0.0/16 (AD 1), an OSPF route to 172.16.5.0/24 (AD 110, cost 5), and an OSPF route to 172.16.5.0/24 via a different neighbour (AD 110, cost 12). The packet matches all three prefixes, but the /24 routes are more specific than the /16, so the static route is out despite its excellent AD of 1 — longest prefix match beats AD. Between the two OSPF /24 routes, the AD is the same, so the metric decides: the cost-5 route wins. If both OSPF routes had cost 5, the router would install both and load-balance. Notice the order of the reasoning: prefix length first, AD second, metric third. Any question that asks which route a router uses is answered by walking these three steps in order.

Two practical details round out the topic. A router makes its forwarding decision per packet, using only the destination address — it does not remember previous packets or consider the source. And the routing table only contains the best route for each destination: show ip route shows winners only, which is why a troubleshooting question that shows a missing route usually means a competing route with a better AD won the election, not that the protocol failed to learn the route at all.

Connected and local routes

Two route types appear in every routing table and confuse candidates because they look similar. A connected route (code C) is the network attached to an interface: when you configure 192.168.1.1/24 on GigabitEthernet0/0, the router installs C 192.168.1.0/24 as directly connected, with an administrative distance of 0. A local route (code L) is the router's own interface address as a /32 host route: L 192.168.1.1/32. The local route tells the router that packets addressed to its own interface address should be processed locally rather than forwarded. Both are installed automatically when an interface is configured and up, and both disappear if the interface goes down. The exam sometimes shows a routing table and asks which entry a packet to the router's own address matches — the answer is the local route, because a /32 is the longest possible prefix match. Another useful detail: show ip route accepts filters, so show ip route ospf shows only OSPF routes and show ip route 10.1.1.5 shows the single route the router would use for that destination — a fast way to check a forwarding decision without reading the whole table.

Advertisement

Exam traps to watch for

Practice questions

Test yourself on this guide. Answers are checked instantly, with a full explanation for each question.

Q1.A router has routes to 10.0.0.0/8 via OSPF and to 10.1.1.0/24 via RIP. A packet arrives for 10.1.1.50. Which route does the router use?

Report an error

Q2.In the routing table entry 'O 10.1.1.0/24 [110/2] via 192.168.1.2', what do the numbers 110 and 2 represent?

Report an error

Q3.A router learns the network 192.168.5.0/24 from OSPF (AD 110) and from RIP (AD 120). Which route is installed in the routing table?

Report an error

Q4.What is the administrative distance of a static route, and of a directly connected network?

Report an error

Q5.A packet arrives for a destination that matches no route in the routing table, and the router has no default route configured. What does the router do?

Report an error

Q6.What does the routing protocol code 'D' mean in show ip route output?

Report an error

Q7.Two OSPF routes to 172.16.10.0/24 have the same administrative distance and the same cost, via different next hops. What does the router do?

Report an error

Q8.The top of show ip route output reads: 'Gateway of last resort is 192.168.1.1 to network 0.0.0.0'. What does this tell you?

Report an error

Q9.A router receives a packet destined for 203.0.113.44. Its routing table contains a static route to 203.0.113.0/24 (AD 1) and an OSPF route to 203.0.113.32/27 (AD 110). Which route forwards the packet?

Report an error