3.1 Interpret the parts of a routing table
CCNA 200-301 v1.1 · 3.0 IP Connectivity
The routing table is the router's list of known destinations. Each line says how the route was learned (the code), which addresses it covers (prefix and mask), how trustworthy its source is (administrative distance), how far it is (metric), and where to send the packet (next hop and exit interface). Reading it fluently is half of every routing question on the CCNA.
What you must know
- Name the common route codes: C, L, S, S*, O, O IA, D, B, R.
- Read a prefix and mask, and explain the "variably subnetted" header lines.
- Find the next hop and exit interface of any route.
- Recite the default administrative distances and say what the bracket
[110/2]means. - Say what a metric measures for OSPF, EIGRP and RIP.
- Find the gateway of last resort and explain what happens when it is not set.
Routing protocol code
The letters on the left say where each route came from. This is R1's table in the drawing:
R1# show ip route
Codes: L - local, C - connected, S - static, R - RIP, B - BGP,
D - EIGRP, O - OSPF, IA - OSPF inter area, * - candidate default
Gateway of last resort is 203.0.113.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 203.0.113.1
10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
C 10.0.12.0/30 is directly connected, GigabitEthernet0/1
L 10.0.12.1/32 is directly connected, GigabitEthernet0/1
C 10.0.13.0/30 is directly connected, GigabitEthernet0/2
L 10.0.13.1/32 is directly connected, GigabitEthernet0/2
O 10.2.2.0/24 [110/2] via 10.0.12.2, 00:04:11, GigabitEthernet0/1
D 10.3.3.0/24 [90/130816] via 10.0.13.3, 00:02:09, GigabitEthernet0/2
203.0.113.0/24 is variably subnetted, 2 subnets, 2 masks
C 203.0.113.0/30 is directly connected, GigabitEthernet0/0
L 203.0.113.2/32 is directly connected, GigabitEthernet0/0| Code | Source |
|---|---|
| C | Connected: the subnet of an interface that is up/up. |
| L | Local: the router's own address on that interface, as a /32. |
| S | Static route. S* is a static default route, the candidate default. |
| O | OSPF inside the area. O IA from another area, O E1/O E2 external. |
| D | EIGRP (from DUAL). D EX is external. |
| B | BGP. |
| R | RIP. |
Prefix
The prefix is the network part of the destination, such as 10.2.2.0. A route covers every address that shares the prefix's first bits, as many as the mask says. A /32 route covers exactly one address.
Network mask
The mask is written as a prefix length, /24. When a classful network is split into subnets of different sizes, IOS groups them under a header line such as 10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks. The header is not a route: nothing is forwarded by it.
Next hop
via 10.0.12.2 is the next-hop address: the neighbor that gets the packet. The router must find how to reach that address too (a recursive lookup), which normally hits a connected route and gives the exit interface, GigabitEthernet0/1. Connected routes have no next hop; they name the interface directly.
Administrative distance
The first number in brackets is the administrative distance (AD): how much the router trusts the source. When two sources offer the same prefix and length, the lower AD is installed.
| Source | Default AD |
|---|---|
| Connected | 0 |
| Static | 1 |
| eBGP | 20 |
| EIGRP (internal) | 90 |
| OSPF | 110 |
| RIP | 120 |
| EIGRP external | 170 |
| iBGP | 200 |
| Unusable | 255 |
Metric
The second number is the metric: the cost of the route within its own protocol. OSPF uses a cost based on bandwidth ([110/2]), EIGRP a composite of bandwidth and delay ([90/130816]), RIP a hop count. Static routes show 0. Metrics only compare routes from the same protocol.
Gateway of last resort
The gateway of last resort is the default route, 0.0.0.0/0, used when no other route matches. Here it is 203.0.113.1, set by a static default route. When the table says Gateway of last resort is not set, a packet that matches nothing is dropped and the sender gets an ICMP unreachable.
Commands
show ip route | The whole IPv4 table with codes, AD, metric, next hop, age and exit interface. |
show ip route 10.2.2.0 | One route in detail, including its source, AD and metric. |
show ip route 10.2.2.77 | Which route an address actually matches (longest prefix). |
show ip route ospf | Only the routes of one source; also static, connected, eigrp. |
show ipv6 route | The IPv6 table, with the same layout. |
Exam traps
[110/2]is AD 110 and metric 2, in that order.- The
variably subnettedline is a header, not a route. - An
Lroute is the router's own address (/32); theCroute is the whole subnet. - AD only decides between sources offering the same prefix length. A longer prefix always wins first.
- A route to an interface that is down disappears from the table, and so do the routes that used it.
Check yourself
- What do the numbers in
O 10.2.2.0/24 [110/2]mean? - Administrative distance 110 (OSPF) and an OSPF cost of 2.
- Which line tells you the router can still reach the internet with no specific route?
Gateway of last resort is 203.0.113.1 to network 0.0.0.0, backed by theS* 0.0.0.0/0route.- OSPF and EIGRP both offer 10.5.0.0/16. Which is installed by default?
- EIGRP, with AD 90 against OSPF's 110.
- What is the difference between the
CandLlines for Gi0/1? C 10.0.12.0/30is the connected subnet;L 10.0.12.1/32is the router's own address on it.
Labs
Try it live: Static and floating static routes