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.
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. 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. 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. 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.
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 parts of one route line
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
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.10Shows the single route R1 would use for this address, with its source, distance and next hop.
show ip route staticLists only static routes. Swap in connected or ospf to filter by source.
show ip route | include ^S|^CA quick filter when the table is long.
Test yourself on reading the routing table
What does the code L mean on 10.0.12.1/32?
In [1/0], what is the 1?
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.