3.1 Routing Table Components
Key Takeaways
- The routing table contains prefix/mask, next-hop IP, outgoing interface, administrative distance, and metric.
- Administrative distance (AD) determines which routing source is trusted most (lower AD = more trusted).
- Directly connected routes have AD 0, static routes have AD 1, OSPF has AD 110, EIGRP internal has AD 90.
- The gateway of last resort (default route 0.0.0.0/0) is used when no specific route matches.
- Routing protocol codes: C=connected, L=local, S=static, O=OSPF, D=EIGRP, R=RIP, B=BGP.
The routing table is the most important data structure on a router. It is the database the router consults for every single packet to decide where to forward it. On the CCNA 200-301 exam (roughly 100-120 items, 120 minutes, passing near 825/1000 on a 300-1000 scale), reading show ip route output fluently is a core skill tested in both multiple-choice and simulation items.
Viewing the Routing Table
Router# show ip route
Sample Routing Table Output
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, O - OSPF, IA - OSPF inter area
* - candidate default
Gateway of last resort is 10.0.0.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 10.0.0.1
C 10.0.0.0/30 is directly connected, GigabitEthernet0/0
L 10.0.0.2/32 is directly connected, GigabitEthernet0/0
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 10.0.0.1, 00:05:23, GigabitEthernet0/0
S 192.168.30.0/24 [1/0] via 10.0.0.1
D 192.168.40.0/24 [90/3072] via 10.0.0.1, 00:15:42, GigabitEthernet0/0
Notice every connected (C) route is paired with a local (L) /32 route — the L route is the router's own interface address. The L entry is how the router knows a packet is destined for itself.
Route Entry Components
Each entry packs several fields. In the bracket [110/2], the first number is administrative distance, the second is metric.
| Component | Example | Purpose |
|---|---|---|
| Route source code | O (OSPF) | How the route was learned |
| Destination prefix | 192.168.20.0 | Network being reached |
| Prefix length | /24 | Defines the network boundary |
| Administrative distance | [110/...] | Trustworthiness of the source |
| Metric | [.../2] | Cost within the routing protocol |
| Next-hop address | via 10.0.0.1 | Where to send the packet |
| Route age | 00:05:23 | How long ago the route was learned |
| Outgoing interface | GigabitEthernet0/0 | Interface to send the packet out |
Routing Protocol Codes
| Code | Protocol | Description |
|---|---|---|
| C | Connected | Directly connected networks |
| L | Local | The router's own interface /32 addresses |
| S | Static | Manually configured routes |
| S* | Static default | Default route (0.0.0.0/0) marked candidate default |
| R | RIP | Routing Information Protocol |
| D | EIGRP | Enhanced Interior Gateway Routing Protocol |
| O | OSPF | Open Shortest Path First |
| O IA | OSPF Inter-Area | OSPF route from a different area |
| B | BGP | Border Gateway Protocol |
Administrative Distance (AD)
Administrative distance measures the trustworthiness of a route source. When a router learns about the same destination prefix from multiple sources, it installs only the route with the lowest AD.
| Route Source | Default AD |
|---|---|
| Connected | 0 |
| Static | 1 |
| EIGRP summary | 5 |
| eBGP | 20 |
| EIGRP (internal) | 90 |
| OSPF | 110 |
| IS-IS | 115 |
| RIP | 120 |
| EIGRP (external) | 170 |
| iBGP | 200 |
| Unreachable | 255 (never installed) |
On the Exam: Memorize Connected (0), Static (1), EIGRP internal (90), OSPF (110), and RIP (120). A route with AD 255 is never installed. If a router learns 10.1.1.0/24 via OSPF (110) and a static route (1), the static route wins because 1 < 110.
Metric
The metric compares routes learned from the same protocol. AD compares routes from different protocols — keep these two roles separate.
| Protocol | Metric | What It Measures |
|---|---|---|
| RIP | Hop count | Routers to destination (max 15) |
| OSPF | Cost | Based on bandwidth (lower = better) |
| EIGRP | Composite | Bandwidth + delay by default |
| BGP | Path attributes | AS-path length, local preference, MED |
Gateway of Last Resort and Longest Prefix Match
The gateway of last resort is the default route 0.0.0.0/0. Because it has zero network bits, it matches every destination but is always the least specific option. The router always applies longest prefix match first: the most specific (longest mask) matching route wins.
Example: A packet for 192.168.10.50 against these entries:
- 0.0.0.0/0 (matches — 0 bits)
- 192.168.10.0/24 (matches — 24 bits)
- 192.168.10.48/28 (matches — 28 bits)
The router forwards using 192.168.10.48/28 because /28 is the longest match. A host route (/32) always beats any shorter prefix for that address.
Decision order recap: longest prefix match first, then AD (across protocols), then metric (within a protocol).
Worked Example: Reading a Bracketed Entry
Consider the line O 192.168.20.0/24 [110/2] via 10.0.0.1, 00:05:23, GigabitEthernet0/0. Decode every field: the O means OSPF learned it; 192.168.20.0/24 is the destination prefix and mask; 110 inside the brackets is the administrative distance (OSPF's default), confirming the source; 2 is the OSPF cost metric; 10.0.0.1 is the next hop the router will forward to; 00:05:23 is how long the route has lived in the table; and GigabitEthernet0/0 is the egress interface.
If a second OSPF entry for the same prefix appeared with [110/2] via a different next hop, the router would install both and load-balance, because AD and metric tie.
Connected vs. Local Routes — A Common Trap
Exam items often show paired entries and ask which is which. A connected (C) route represents the whole subnet wired to an interface (for example C 192.168.10.0/24), installed the moment the interface comes up with a valid IP. The local (L) route is the host-specific /32 of the router's own address on that interface (L 192.168.10.1/32). The local route is how the router recognizes traffic addressed to itself versus traffic it must forward. Both vanish instantly if the interface goes down or loses its address — connected and local routes are never learned from a protocol, so they have no metric to compare.
Why AD and Metric Are Not Interchangeable
A frequent misconception is that a route with a lower metric always wins. It does not. Administrative distance is checked before metric, and only among routes of equal prefix length. A static route (AD 1, no real metric) beats an OSPF route (AD 110) with cost 1 to the same /24, even though OSPF's cost looks small — because AD is compared first. Metric only ever decides between two routes from the same protocol. Keep this separation crisp: AD picks the protocol you trust, metric picks the best path within it.
Which route would a router prefer if it learns about 10.1.1.0/24 from both OSPF (AD 110) and EIGRP internal (AD 90)?
A router has these routes: 10.0.0.0/8, 10.1.0.0/16, and 10.1.1.0/24. A packet arrives destined for 10.1.1.50. Which route does the router use?
What is the administrative distance of a directly connected route?