Course contents

Chapter 8: RoutingLesson 1 of 16

Reading the routing table

Route codes, connected and local routes, and what each part of a route line means.

Beginner · 8 min read

Technical definition

The routing table is the list of routes a router uses to forward packets. Each route names a destination network and prefix length, the source it came from (connected, local, static or a routing protocol), and the next-hop address or exit interface to use.

Internet works, the branch server doesn't

Users on PC1 say they can reach the internet but not the branch server. Before you change anything, you log in to R1 and look at its routing table. If you can read it quickly, you can identify which prefix and next hop need investigation.

Connected, static and dynamic routes

The routing table is the router's list of every network it knows how to reach. Each line, called a route, says: "to reach this network, send the packet to this next hop, out of this interface". Routes come from three sources:

  • Connected: networks on the router's own interfaces. Added automatically when an interface is up and has an IP address.
  • Static: routes an administrator types in by hand.
  • Dynamic: routes learned from other routers through a routing protocol such as OSPF.
Diagram
Where R1's routes come from
Where R1's routes come from
192.168.1.0/24203.0.113.0/3010.0.12.0/3010.0.23.0/30192.168.2.0/24192.168.3.0/24PC1IP 192.168.1.10ISPIP 203.0.113.1R1R2R3PC2IP 192.168.2.10ServerIP 192.168.3.10

Device key: PC1, PC2 (computer) · ISP (network / service) · R1, R2, R3 (router)

Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • PC1: IP 192.168.1.10
  • ISP: IP 203.0.113.1
  • PC2: IP 192.168.2.10
  • Server: IP 192.168.3.10
  1. 1. Connected and local: R1's three working interfaces give it three connected networks and three local /32 routes, with no configuration beyond the IP addresses.
  2. 2. Static: R1 can't see the LANs behind R2 and R3. An administrator adds routes for 192.168.2.0/24 and 192.168.3.0/24 via 10.0.12.2.
  3. 3. Static default: everything else goes to the ISP at 203.0.113.1. The * marks it as the candidate default route.

Read R1's table

Here is R1's table. The long legend at the top is trimmed. This output is based on Cisco documentation, not run on a lab device.

Example output · based on Cisco documentation; exact format varies by platform and software version
R1#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
       * - candidate default, U - per-user static route
       ...

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, 2 subnets, 2 masks
C        10.0.12.0/30 is directly connected, GigabitEthernet0/1
L        10.0.12.1/32 is directly connected, GigabitEthernet0/1
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, GigabitEthernet0/0
L        192.168.1.1/32 is directly connected, GigabitEthernet0/0
S     192.168.2.0/24 [1/0] via 10.0.12.2
S     192.168.3.0/24 [1/0] via 10.0.12.2
      203.0.113.0/24 is variably subnetted, 2 subnets, 2 masks
C        203.0.113.0/30 is directly connected, GigabitEthernet0/2
L        203.0.113.2/32 is directly connected, GigabitEthernet0/2
The indented lines with no code ("is variably subnetted") are just headings. They group subnets of the same classful network and are not routes themselves.

The parts of one route line

Diagram
Read the route, then resolve its next hop
Read the route, then resolve its next hop
Read the route, then resolve its next hopS means static. 192.168.3.0/24 is the destination prefix. [1/0] is administrative distance 1 and metric 0. Next hop 10.0.12.2 resolves through connected subnet 10.0.12.0/30 on R1 Gi0/1. The next hop is not the final server.SSourceStatic route192.168.3.0/24DestinationNetwork + prefix length[1/0]AD / metric1 / 0via 10.0.12.2Next hopNeighbour R2Resolve 10.0.12.2 → connected 10.0.12.0/30Exit R1 Gi0/1 · local address 10.0.12.1/30
The static-route example matches the routing course lab. Brackets describe route selection information; forwarding uses the installed matching prefix.

A route learned by a protocol also shows its age and exit interface, for example O 192.168.3.0/24 [110/3] via 10.0.12.2, 00:05:12, GigabitEthernet0/1.

Why connected and local routes both exist

Diagram
An interface creates a subnet route and a route to the router itself
An interface creates a subnet route and a route to the router itself
An interface creates a subnet route and a route to the router itselfR1 Gi0/0 is 192.168.1.1/24 and operational. Connected route 192.168.1.0/24 covers LAN neighbours; local route 192.168.1.1/32 identifies the router itself. A packet for .1 matches the local /32, while a packet for .20 matches the connected /24.R1Gi0/0 · 192.168.1.1/24 · up/upC · 192.168.1.0/24To 192.168.1.20: forward onto LANResolve the host’s MAC address.L · 192.168.1.1/32To 192.168.1.1: deliver locallyThe destination is this router.
An IPv4 Ethernet example. Directly attached hosts still need Layer 2 resolution; a route to the local address does not automatically permit SSH or another service.

If an interface goes down, its C and L routes disappear from the table, and so do any static routes whose next hop was only reachable through it.

Shorter ways to ask the table

On a router carrying thousands of routes, reading the whole table is rarely practical. The first command below answers the question usually being asked ("where does this address go?") and tends to be the one engineers reach for first.

show ip route 192.168.3.10

Shows the single route R1 would use for this address, with its source, distance and next hop.

show ip route static

Lists only static routes. Swap in connected or ospf to filter by source.

show ip route | include ^S|^C

A quick filter when the table is long.

Test yourself on reading the routing table

Predict · scenario 1

What does the code L mean on 10.0.12.1/32?

Predict · scenario 2

In [1/0], what is the 1?

Predict · scenario 3

You remove the IP address from Gi0/0 on R1. What happens to 192.168.1.0/24 in the table?

Cisco reference: Route installation, administrative distance and forwarding.