Watch on Instagram

Network Bytes · Episode 42 · CCNA 3.1

Reading a routing table

Every line of show ip route is a map entry. The letter on the left says how the router learned the route (C connected, L local, S static, O OSPF), and the rest of the line gives the destination network, the next hop and the exit port.

Posted · About a 1 minute watch, 4 minute read · Take the quiz

A wall of text that is really a map

Type show ip route on a Cisco router and you get a wall of text. Read it one line at a time and it gets simple: every line is one entry in the router's map of networks, and the letter at the start of the line is the map's legend. A small router might show:

`` C 10.0.0.0/30 is directly connected, Gi0/1 L 10.0.0.1/32 is directly connected, Gi0/1 O 10.2.0.0/16 [110/20] via 10.0.0.2, 00:01:12, Gi0/1 S 10.5.0.0/16 [1/0] via 192.168.1.254 C 192.168.1.0/24 is directly connected, Gi0/0 L 192.168.1.1/32 is directly connected, Gi0/0 ``

C and L: what the router is plugged into

C (connected) is a network plugged straight into one of the router's interfaces. When you give interface Gi0/0 the address 192.168.1.1/24 and bring it up, the router adds C 192.168.1.0/24. Nobody has to tell it about that network; it is attached.

L (local) is the router's own address on that network, listed as a /32 host route (L 192.168.1.1/32). It tells the router "packets for this exact address are for me", so it keeps them instead of forwarding them. Every connected network comes with its matching local route.

S and O: routes to networks further away

S (static) is a route an engineer typed in by hand, for example ip route 10.5.0.0 255.255.0.0 192.168.1.254. It stays until someone removes it, even if the network behind it changes.

O (OSPF) is a route the router learned automatically from its neighbor routers using the OSPF routing protocol. If the network changes, OSPF updates the route on its own. Other letters you will meet include D (EIGRP), R (RIP) and B (BGP), and an asterisk marks a candidate default route, as in S*.

The parts of one line

Take O 10.2.0.0/16 [110/20] via 10.0.0.2, 00:01:12, Gi0/1:

  • O: the code, learned by OSPF.
  • 10.2.0.0/16: the destination network this entry covers.
  • [110/20]: the administrative distance (110, how trusted the source is) and the metric (20, the route's cost). That's EP44.
  • via 10.0.0.2: the next hop, the address of the next router to hand the packet to.
  • 00:01:12: how long ago the route was learned or updated.
  • Gi0/1: the exit interface, the port the packet leaves through.

Connected and local lines have no via, because there is no next router to go through: the network is right there on the port.

Try it yourself

Your own computer has a routing table too. On Windows, open Command Prompt and run route print; on macOS run netstat -rn; on Linux run ip route. Look for the line for your home network (often 192.168.x.0 with a /24 mask or 255.255.255.0): it has no gateway, because your computer is plugged straight into that network, just like a router's C route.

Good to know

  • The codes come from Cisco IOS show ip route: C connected, L local (the router's own interface address as a /32 host route), S static, O OSPF. Others include D (EIGRP), R (RIP) and B (BGP), and an asterisk marks a candidate default route (S*).
  • The numbers in brackets are [administrative distance/metric] (EP44).
  • The full line also shows the route's age; the video leaves it out to keep the line short.
  • In the video the /16 mask is shown on screen but not spoken.

For CCNA learners

This lines up with CCNA 200-301 exam topic 3.1, interpret the components of a routing table: be able to read a show ip route line and name its routing protocol code, prefix, network mask, next hop, administrative distance and metric.

Answer to the comment question

To the next-hop router at 10.0.0.2, out interface Gi0/1. The address after via is the next router to hand the packet to, so a packet for any address in 10.2.0.0/16 leaves through Gi0/1 toward 10.0.0.2, and that router makes the next decision.

Test your knowledge

Quick quiz: Reading a routing table

4 multiple-choice questions. Pick one answer for each, then check how you did.

1In show ip route, what does the code C mean?
2What does an L route such as L 192.168.1.1/32 show?
3A route was added with the ip route command. Which code does it get?
4In O 10.2.0.0/16 [110/20] via 10.0.0.2, Gi0/1, what is Gi0/1?

Sources

Video transcript

What do the letters C, S, O and L mean in a routing table?

Type show IP route on a Cisco router and you get a wall of text. But every line is a map entry, and the letter on the left is the map's legend.

C means connected: a network plugged straight into one of the router's ports. L means local: the router's own address on that network.

S means static: an engineer typed that route in by hand. O means OSPF: the router learned it automatically from neighbor routers.

After the letter comes the destination network. Then the word via, and an address. That's the next router to hand the packet to. Last comes the exit port.

A line reads: O 10.2.0.0 via 10.0.0.2. Where does the packet go next? Comment your answer below!

That's your byte.

More from Network Bytes

All Network Bytes lessons