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

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
CodeSource
CConnected: the subnet of an interface that is up/up.
LLocal: the router's own address on that interface, as a /32.
SStatic route. S* is a static default route, the candidate default.
OOSPF inside the area. O IA from another area, O E1/O E2 external.
DEIGRP (from DUAL). D EX is external.
BBGP.
RRIP.

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.

SourceDefault AD
Connected0
Static1
eBGP20
EIGRP (internal)90
OSPF110
RIP120
EIGRP external170
iBGP200
Unusable255

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 routeThe whole IPv4 table with codes, AD, metric, next hop, age and exit interface.
show ip route 10.2.2.0One route in detail, including its source, AD and metric.
show ip route 10.2.2.77Which route an address actually matches (longest prefix).
show ip route ospfOnly the routes of one source; also static, connected, eigrp.
show ipv6 routeThe IPv6 table, with the same layout.

Exam traps

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 the S* 0.0.0.0/0 route.
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 C and L lines for Gi0/1?
C 10.0.12.0/30 is the connected subnet; L 10.0.12.1/32 is the router's own address on it.

Labs

Try it live: Static and floating static routes

More topics in 3.0 IP Connectivity