Routing Tables & Forwarding Decisions
CCNA 200-301 · IP Connectivity
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.
Exam traps to watch for
- Comparing administrative distance before checking prefix length. Longest prefix match always wins first, whatever the AD values.
- Reading [110/2] as [metric/AD]. It is always [administrative distance/metric].
- Thinking the routing table shows all learned routes. It shows only the best route per destination; losing routes are not installed.
- Forgetting that a router with no matching route and no default route drops the packet. It does not forward it to a random interface.
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?
Explanation: Longest prefix match is the first rule in the forwarding decision: the /24 route is more specific than the /8 route, so the router uses the RIP /24 route even though RIP's AD (120) is worse than OSPF's (110). Option A is wrong because AD is only compared between routes of the same prefix length. Option C is wrong because overlapping routes of different lengths are normal and do not cause drops. Option D is wrong because load balancing only happens between equal-cost routes to the same prefix.
Exam objective: 200-301 3.2: Determine how a router makes a forwarding decision by default — longest prefix match
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?
Explanation: The bracketed numbers in a routing table entry are always [administrative distance/metric]: 110 is OSPF's administrative distance and 2 is the route's metric (OSPF cost). Option A reverses the order. Option B is wrong because OSPF does not use hop count (that is RIP's metric) and the second number is not a path count. Option C is wrong because the prefix length is shown in the /24 notation and VLANs do not appear in routing table entries.
Exam objective: 200-301 3.1: Interpret the components of routing table — administrative distance and metric
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?
Explanation: When two routes to the same destination have the same prefix length, the router installs the one with the lower administrative distance: OSPF (110) beats RIP (120), so only the OSPF route appears in the table. Option B is wrong because metric simplicity is irrelevant — AD decides between different protocols. Option C is wrong because routers do not load-balance between routes from different protocols with different ADs. Option D is wrong because AD exists precisely to resolve this choice.
Exam objective: 200-301 3.2: Determine how a router makes a forwarding decision by default — administrative distance
Q4.What is the administrative distance of a static route, and of a directly connected network?
Explanation: A directly connected network has an AD of 0 — the most trusted route possible, since the router is attached to the network itself — and a manually configured static route has an AD of 1. Option A is wrong because 90 is EIGRP's internal AD. Option B is wrong because 110 is OSPF's AD. Option C is wrong because 120 is RIP's AD.
Exam objective: 200-301 3.2: Determine how a router makes a forwarding decision by default — administrative distance
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?
Explanation: With no matching route and no gateway of last resort, the router has nowhere to send the packet, so it drops it and informs the sender with an ICMP destination unreachable message. Option A is wrong because routers never forward a packet to an arbitrary interface. Option B is wrong because routers do not broadcast packets they cannot route. Option D is wrong because routers do not queue packets waiting for routes to appear.
Exam objective: 200-301 3.1: Interpret the components of routing table — gateway of last resort
Q6.What does the routing protocol code 'D' mean in show ip route output?
Explanation: The code D stands for EIGRP (from its DUAL algorithm heritage). Option A is wrong because DHCP does not install routes in the routing table. Option C is wrong because OSPF routes are coded O. Option D is wrong because dropped routes do not appear in the routing table at all.
Exam objective: 200-301 3.1: Interpret the components of routing table — routing protocol code
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?
Explanation: Equal-cost routes from the same protocol — same prefix, same AD, same metric — are both installed in the routing table, and the router load-balances traffic across them. Option A is wrong because the router does not prefer the first-learned route when costs are equal. Option C is wrong because equal-cost routes are a normal, desirable situation, not an error. Option D is wrong because the next-hop address is never a tiebreaker in route selection.
Exam objective: 200-301 3.2: Determine how a router makes a forwarding decision by default — routing protocol metric
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?
Explanation: The gateway of last resort is the default route (0.0.0.0/0): any packet that matches no more specific route is forwarded to 192.168.1.1. Option A is wrong because a default route is itself a route, and the router may have many specific routes as well. Option C is wrong because the gateway of last resort is a next-hop router, not the local router's own address. Option D is wrong because forwarding to the gateway is normal behaviour, not dropping.
Exam objective: 200-301 3.1: Interpret the components of routing table — gateway of last resort
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?
Explanation: The destination 203.0.113.44 falls inside both prefixes, but the /27 is more specific than the /24, so longest prefix match selects the OSPF route — AD is only compared when prefix lengths are equal. Option A is wrong because AD never overrides a longer prefix match. Option C is wrong because overlapping routes are normal and the router resolves them by prefix length. Option D is wrong because static routes do not automatically beat dynamic routes; the decision follows prefix length, then AD, then metric.
Exam objective: 200-301 3.2: Determine how a router makes a forwarding decision by default — longest prefix match