Week 6 · Lesson 11

The Routing Table

When a router receives a packet, it does not think. It looks up the destination in its routing table and follows the most specific match. Reading that table — and its codes, distances, and metrics — is a core CCNA skill.

CCNA 200-301 Domain 3.0 IP Connectivity Verified 2026-10-11
Learning objectives
Part 1

What the routing table is

Every Layer 3 device keeps a routing table (also called the routing information base). It is a map of known destination networks and, for each one, the best way to reach it: an outgoing interface and/or a next-hop address. When a packet arrives, the router reads the destination IP address, finds the matching entry, and forwards the packet accordingly. If two entries could match, the router applies the longest-prefix rule; if none match and no default route exists, the packet is dropped and an ICMP “destination unreachable” message is returned.

A router populates its table from three sources: networks it is directly connected to (added automatically), static routes entered by an administrator, and dynamic routes learned from routing protocols. Lesson 12 covers those sources.

In this lesson · select a part to jump

Part 2

What a route entry holds

Part of the entryExampleMeaning
Destination network / prefix192.168.20.0/24The network this route can reach.
Next-hop address or exit interfacevia 192.168.10.2 · or · Gi0/1Where to send packets for that network. Directly connected routes show an interface.
Administrative distance110Trustworthiness of the route source; lower is more trusted.
Metric2Cost as measured by the originating protocol (hop count, cost, composite).
Source codeOHow the route was learned (OSPF here).

In show ip route output the distance and metric appear together in brackets, as [110/2]. Timers (the route’s age) appear for dynamic routes.

Part 3

Route types and the legend

The first column of each line is a one-letter (or two-letter) code. These are the codes the exam expects:

CodeRoute typeHow it is learned
CConnectedAutomatically, for a network on one of the router’s own interfaces.
LLocalThe router’s own interface address; a host route (/32).
SStaticEntered manually by an administrator.
DEIGRPLearned dynamically from EIGRP.
OOSPFLearned dynamically from OSPF.
RRIPLearned dynamically from RIP.
Exam tip Memorise the single letters. The easiest way is alphabetic association: Connected, Local, Static, D = EIGRP (Enhanced IGRP, Cisco’s successor to IGRP’s “I”), O = OSPF, R = RIP. A code may be followed by * to mark a candidate default route (for example S*).
Reference table · select a row

Key ideas & exam traps · select one

Part 4

Reading show ip route

Here is an illustrative output block. The exact addresses are chosen for teaching; the format is what a real Cisco IOS router prints.

Router# show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route

Gateway of last resort is 192.168.10.2 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 192.168.10.2
      10.1.0.0/16 is variably subnetted, 2 subnets, 2 masks
C        10.1.0.0/16 is directly connected, GigabitEthernet0/0
L        10.1.1.1/32 is directly connected, GigabitEthernet0/0
      192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.10.0/24 is directly connected, GigabitEthernet0/1
L        192.168.10.1/32 is directly connected, GigabitEthernet0/1
O        192.168.20.0/24 [110/2] via 192.168.10.2, 00:05:31, GigabitEthernet0/1
D        192.168.30.0/24 [90/3072] via 192.168.10.2, 00:12:04, GigabitEthernet0/1
R        192.168.40.0/24 [120/1] via 192.168.10.2, 00:00:18, GigabitEthernet0/1
Note The codes line lists many protocols for completeness; you only need the core six. The line “10.1.0.0/16 is variably subnetted, 2 subnets, 2 masks” is a parent line; the indented C and L lines beneath it are its children, so classes of the same major network with different mask lengths are grouped.
Destination Next Hop / Interface [AD/Metric] Src 0.0.0.0/0 via 192.168.10.2 [1/0] S* 192.168.10.0/24 GigabitEthernet0/1 [0/0] C 192.168.20.0/24 via 192.168.10.2 [110/2] O 192.168.30.0/24 via 192.168.10.2 [90/3072] D 192.168.40.0/24 via 192.168.10.2 [120/1] R Lower administrative distance means a more trusted source of the same prefix.
A routing table in miniature. Each row answers: which network, out which interface or next hop, how trusted (AD), and how costly (metric) — with a one-letter code for the source.
Part 5

Longest-prefix match

When more than one entry could match a destination address, the router chooses the entry with the longest prefix — the one with the most matching bits, also called the most specific match. This rule is applied before any consideration of administrative distance or metric. Distance and metric only break ties between routes for the same prefix length.

Definition — longest-prefix match The router forwards a packet using the route whose network prefix has the greatest length (the largest mask) among all routes that match the destination address. Most bits matched wins, regardless of AD or metric.

Example: a packet for 10.1.1.55. Two routes match, 10.1.0.0/16 and 10.1.1.0/24. The /24 is longer (24 bits versus 16), so it is selected even if the /16 had a lower administrative distance. Only if no longer match existed would the router fall back to the /16.

Part 6

The default route and gateway of last resort

A default route is a route for 0.0.0.0/0 — a prefix of length zero, meaning “everything”. Because it matches every address but has the shortest possible prefix, it is only used when no more specific route matches. Routers commonly point it at an upstream provider. In the output, the * next to S* marks it as the candidate default, and the line “Gateway of last resort is 192.168.10.2 to network 0.0.0.0” names the next hop the router uses for otherwise-unknown destinations.

Definition — gateway of last resort The gateway of last resort is the next-hop address used for packets that match no other route. It is installed when a default route (0.0.0.0/0) is present.
Warning “Gateway of last resort is not set” means the router has no default route. Any packet to an unknown network is then dropped. That is normal on an internal router that knows all its networks, but wrong on an edge router facing the Internet.
Part 7

Connected and local routes

When you configure an IP address on an interface and bring it up, IOS adds two routes automatically. The connected route (C) covers the whole subnet; the local route (L) is a host route (/32) for the router’s own interface address, used to process traffic addressed to the router itself. For example, an interface configured with 10.1.1.1/16 produces a C 10.1.0.0/16 line and an L 10.1.1.1/32 line. Both carry an administrative distance of 0, the most trusted value.

Part 8

Worked lookup examples

Destination packetMatching routesChosen routeWhy
10.1.1.5510.1.0.0/16 · 10.1.1.0/2410.1.1.0/24Longest prefix (24 > 16).
10.1.9.810.1.0.0/16 only10.1.0.0/16The only match.
8.8.8.80.0.0.0/0 only0.0.0.0/0No specific route; default route used.
172.16.5.4none (no default)— droppedNo match and no gateway of last resort.
Exam tip Longest-prefix match is decided before administrative distance. A common trap shows two routes with different ADs but different prefix lengths — the answer is always the longer prefix, not the lower AD. Use AD only when the prefixes are identical.
Part 9

Common pitfalls

Key terms

The vocabulary you need

Every term below appears in the lesson text above. Select one to read its definition, then use the quiz at the end to check what stuck.

Key terms · select a term

Part 10 · Your turn

Review

Check what you have learned with these review questions.

Review · 6 questions

Sources

Sources & references

  1. Cisco. CCNA (200-301) Exam Topics. cisco.com.
  2. IETF. Request for Comments (RFCs). rfc-editor.org.
  3. IANA. Internet Assigned Numbers Authority registries. iana.org.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.