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 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, S=static, O=OSPF, D=EIGRP, R=RIP, B=BGP.
Routing Table Components
The routing table is the most important data structure on a router. It contains all the information the router needs to forward packets to their destinations.
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
Route Entry Components
Each entry in the routing table contains:
| Component | Example | Purpose |
|---|---|---|
| Route source code | O (OSPF) | How the route was learned |
| Destination prefix | 192.168.20.0 | Network being reached |
| Subnet mask / prefix length | /24 | Defines the network boundary |
| Administrative distance | [110/ | Trustworthiness of the route 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 | Physical interface to send the packet |
Routing Protocol Codes
| Code | Protocol | Description |
|---|---|---|
| C | Connected | Directly connected networks |
| L | Local | IP addresses assigned to the router's own interfaces |
| S | Static | Manually configured routes |
| S* | Static default | Default route (0.0.0.0/0) via static |
| 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 from multiple sources, it uses the route with the lowest AD.
| Route Source | Default AD |
|---|---|
| Connected | 0 |
| Static | 1 |
| EIGRP summary | 5 |
| eBGP | 20 |
| EIGRP (internal) | 90 |
| IGRP | 100 |
| OSPF | 110 |
| IS-IS | 115 |
| RIP | 120 |
| EIGRP (external) | 170 |
| iBGP | 200 |
| Unknown / Unreachable | 255 (never used) |
On the Exam: Memorize the AD values for Connected (0), Static (1), EIGRP (90), OSPF (110), and RIP (120). These are the most commonly tested. A route with AD 255 is considered unreachable and is never installed.
Example question scenario: A router learns about network 10.1.1.0/24 via both OSPF (AD 110) and a static route (AD 1). Which route is installed? The static route because AD 1 < AD 110.
Metric
The metric is used to compare routes learned from the same routing protocol. Different protocols use different metrics:
| Protocol | Metric | What It Measures |
|---|---|---|
| RIP | Hop count | Number of routers to the destination (max 15) |
| OSPF | Cost | Based on interface bandwidth (lower = better) |
| EIGRP | Composite | Bandwidth + delay (by default) |
| BGP | Path attributes | AS path length, origin, MED, local preference |
Key distinction: AD compares routes from different routing protocols. Metric compares routes from the same protocol.
Gateway of Last Resort (Default Route)
The gateway of last resort is the default route (0.0.0.0/0). When a packet's destination doesn't match any specific route in the routing table, the router forwards it to the default gateway.
Router(config)# ip route 0.0.0.0 0.0.0.0 10.0.0.1 ! Static default route
The 0.0.0.0/0 route matches every possible destination because it has 0 network bits—meaning all bits are host bits. However, it is always the least preferred match due to the longest prefix match rule.
Longest Prefix Match
When multiple routes match a destination, the router uses the longest prefix match (most specific route):
Example: A packet destined for 192.168.10.50. The routing table has:
- 0.0.0.0/0 → via 10.0.0.1 (matches — 0 bits)
- 192.168.10.0/24 → via 10.0.0.2 (matches — 24 bits)
- 192.168.10.48/28 → via 10.0.0.3 (matches — 28 bits)
The router uses 192.168.10.48/28 because /28 is the longest (most specific) match.
On the Exam: Longest prefix match is a fundamental concept. If a /32 route exists for a specific host, it will always be preferred over any less specific route for the same address. The routing decision process: longest prefix match first, then AD, then metric.
Which route would a router prefer if it learns about 10.1.1.0/24 from both OSPF (AD 110) and EIGRP (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?