How to Read the Cisco Routing Table (show ip route Line by Line)

Read show ip route line by line: which protocol installed each route, the administrative distance and metric, how long the route has been stable, and which interface the packet leaves through, with real captures from IOS XE.

Patch panel terminal showing an annotated Cisco show ip route routing table

show ip route prints the router's routing table, and each line answers five questions: which source installed the route (the code letter on the left), how much the router trusts that source and what the path costs (the [AD/metric] bracket), where the packet goes next (via), how long the route has been stable (the timer), and which interface it leaves through. A C means a directly connected subnet, L is the router's own address on it, S is static, D is EIGRP and O is OSPF.

Knowing the fields is half the job. The other half is noticing what the table leaves out, and that only really shows when something breaks. So everything below comes from three Cisco IOS XE 17.18.2 routers built in my home lab. I read R1's table line by line, then cut a link and timed what changed. One static route kept looking healthy while every packet it carried was dropped. This post sits under the IP Routing guide.

The lab

Routing table lab: R1 learns routes from EIGRP, OSPF and a static route via R2 and R3; cutting R1 to R2 left the static route installed while CEF sent it via R3 and pings failed 0/5; with an exit interface the same failure lost none
Built in my home lab: three IOS XE routers. The static route that survived the link cut is the one to watch.
RouterWhat it adds to R1's table
R1Ethernet0/1 to R2 (192.0.2.0/30), Ethernet0/2 to R3 (192.0.2.4/30), Loopback0 198.51.100.1/32 in no protocol, and a static route for 203.0.113.128/26 via R2
R2EIGRP 100 on the R1 link: Loopback0 198.51.100.2/32 and 203.0.113.0/26. OSPF area 0 on both links: Loopback0 again, plus 203.0.113.64/26. 203.0.113.128/26 is on Loopback3
R3OSPF area 0: Loopback0 198.51.100.3/32 and 203.0.113.128/25, and default-information originate always so everyone gets a default route
R2 to R3192.0.2.8/30 in OSPF, which gives R1 two equal-cost paths to it

A few things here are on purpose. R2's Loopback0 sits in EIGRP and OSPF at the same time. The static route points at R2's link address instead of an interface. Both choices look harmless in the steady-state table, and both come back later in the post.

The full table

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
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, m - OMP
       [... rest of the legend trimmed ...]
       * - candidate default, U - per-user static route

Gateway of last resort is 192.0.2.6 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 192.0.2.6, 00:01:26, Ethernet0/2
      192.0.2.0/24 is variably subnetted, 5 subnets, 2 masks
C        192.0.2.0/30 is directly connected, Ethernet0/1
L        192.0.2.1/32 is directly connected, Ethernet0/1
C        192.0.2.4/30 is directly connected, Ethernet0/2
L        192.0.2.5/32 is directly connected, Ethernet0/2
O        192.0.2.8/30 [110/20] via 192.0.2.6, 00:01:26, Ethernet0/2
                      [110/20] via 192.0.2.2, 00:01:26, Ethernet0/1
      198.51.100.0/32 is subnetted, 3 subnets
C        198.51.100.1 is directly connected, Loopback0
D        198.51.100.2 [90/409600] via 192.0.2.2, 00:01:59, Ethernet0/1
O        198.51.100.3 [110/11] via 192.0.2.6, 00:01:26, Ethernet0/2
      203.0.113.0/24 is variably subnetted, 4 subnets, 2 masks
D        203.0.113.0/26 [90/409600] via 192.0.2.2, 00:01:59, Ethernet0/1
O        203.0.113.65/32 [110/11] via 192.0.2.2, 00:01:26, Ethernet0/1
S        203.0.113.128/26 [1/0] via 192.0.2.2
O        203.0.113.254/32 [110/11] via 192.0.2.6, 00:01:26, Ethernet0/2

That breaks into four layers: the codes legend, the gateway of last resort line, the indented parent headers, and the coded route entries. Only the last layer forwards anything.

The codes legend: what C, L, S, D and O mean

The legend never changes, so the only letters worth learning are the ones that show up in the left margin. This table has six of them:

CodeMeaningIn this lab
CConnected: a subnet on an interface that is up/up. AD 0.192.0.2.0/30 on Ethernet0/1
LLocal: the router's own address on that subnet, as a /32. Lets the router recognise traffic addressed to itself.192.0.2.1/32
SStatic: someone typed ip route. AD 1 by default.203.0.113.128/26
DEIGRP (D for DUAL). D EX is an EIGRP external route.198.51.100.2, 203.0.113.0/26
OOSPF intra-area. O IA is inter-area, O E1/E2 are external.192.0.2.8/30
*Candidate default. Shown next to the code, as in O*E2.0.0.0.0/0

B (BGP) is missing here. When a BGP prefix sits in show ip bgp but never gets a B line, the BGP table and the routing table disagree, and the bracket explained below is usually why.

Gateway of last resort

Gateway of last resort is 192.0.2.6 to network 0.0.0.0 means R1 has a default route. Anything that matches nothing more specific goes to 192.0.2.6 (R3). Without a default, the line reads Gateway of last resort is not set and unmatched packets are dropped. The detail view shows where the default came from:

R1#show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
  Known via "ospf 1", distance 110, metric 1, candidate default path
  Tag 1, type extern 2, forward metric 10
  Last update from 192.0.2.6 on Ethernet0/2, 00:01:27 ago
  Routing Descriptor Blocks:
  * 192.0.2.6, from 198.51.100.3, 00:01:27 ago, via Ethernet0/2
      Route metric is 1, traffic share count is 1
      Route tag 1

An E2 route keeps the metric the originator set (1) no matter how far away you are. forward metric 10 is the internal OSPF cost to reach R3, which OSPF only uses to break a tie between two E2 routes with the same metric. That matters on networks with two exits.

Parent headers are not routes

      192.0.2.0/24 is variably subnetted, 5 subnets, 2 masks
      198.51.100.0/32 is subnetted, 3 subnets

Indented lines with no code letter are summaries. The first says R1 holds five routes inside 192.0.2.0/24 using two prefix lengths (/30 and /32). The second says three routes inside 198.51.100.0, all with the same /32 mask, so IOS prints the mask once on the header. Neither line forwards traffic. When you count routes, count the lines with a code letter.

Anatomy of one entry

O        192.0.2.8/30 [110/20] via 192.0.2.6, 00:01:26, Ethernet0/2
FieldValueMeaning
CodeOOSPF intra-area route
Prefix192.0.2.8/30Destination network and mask length
[AD/metric][110/20]Administrative distance 110 (OSPF), cost 20
Next hopvia 192.0.2.6The neighbour R1 hands the packet to
Age00:01:26Time since this route last changed (hh:mm:ss)
InterfaceEthernet0/2Where the packet leaves

The first number in the bracket compares sources (OSPF against EIGRP against static), and lower wins. The second only compares paths learned from the same protocol. The full table of defaults is in administrative distance explained. Static and connected routes print no age: the S line above has no timer at all, which matters later.

Connected and local: the C/L pair

C        192.0.2.0/30 is directly connected, Ethernet0/1
L        192.0.2.1/32 is directly connected, Ethernet0/1

Every addressed interface adds two lines. The C route is the whole subnet out that port; the L route is R1's own address on it. Both have AD 0, so nothing overrides a connected subnet. Loopback0 shows up as a single C line (198.51.100.1) because a /32 is already a host route. If an expected C line is missing, the interface is not up/up, and an SVI that stays down is the usual case on a switch.

The route you expected is hidden by administrative distance

R2 advertises 198.51.100.2 into both EIGRP and OSPF, yet the table only shows the D line. The OSPF copy is in the database:

R1#show ip ospf database router 198.51.100.2
  Link State ID: 198.51.100.2
  Advertising Router: 198.51.100.2
    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 198.51.100.2
     (Link Data) Network Mask: 255.255.255.255
    [... output trimmed ...]

EIGRP's AD of 90 beats OSPF's 110, so only the EIGRP route goes in the table. OSPF's copy just waits. show ip route lists winners, not candidates. If a route seems to be missing from a protocol, check that protocol's own database before assuming it never arrived. You'll see the OSPF copy turn up in the outage section.

Why an OSPF loopback shows up as /32

R2's Loopback2 is 203.0.113.65/26, but R1 shows O 203.0.113.65/32. R3's 203.0.113.254/25 shows up as a /32 as well. OSPF advertises a loopback as a host route by default, whatever mask you configured. Anyone looking for 203.0.113.64/26 in R1's table won't find it. The fix is one line on the loopback:

R2(config)#interface Loopback3
R2(config-if)#ip ospf network point-to-point
R2(config-if)#ip ospf 1 area 0

R1#show ip ospf database router 198.51.100.2 | include Network/subnet|Mask
     (Link ID) Network/subnet number: 203.0.113.65
     (Link Data) Network Mask: 255.255.255.255
     (Link ID) Network/subnet number: 203.0.113.128
     (Link Data) Network Mask: 255.255.255.192

Loopback2 is still advertised as a /32. Loopback3, with the point-to-point network type, goes out with its real /26 mask.

Two next hops for one prefix

R1#show ip route 192.0.2.8
Routing entry for 192.0.2.8/30
  Known via "ospf 1", distance 110, metric 20, type intra area
  Last update from 192.0.2.6 on Ethernet0/2, 00:01:26 ago
  Routing Descriptor Blocks:
    192.0.2.6, from 198.51.100.3, 00:01:26 ago, via Ethernet0/2
      Route metric is 20, traffic share count is 1
  * 192.0.2.2, from 198.51.100.3, 00:01:26 ago, via Ethernet0/1
      Route metric is 20, traffic share count is 1

R1#show ip cef 192.0.2.8
192.0.2.8/30
  nexthop 192.0.2.2 Ethernet0/1
  nexthop 192.0.2.6 Ethernet0/2

Both paths cost 20, so OSPF installs both. Each Routing Descriptor Block is one usable next hop, and traffic share count is 1 on both means an even split. The asterisk only marks the next block for process-switched packets. CEF does the real forwarding and hashes flows across both next hops, which is why show ip cef is what you check when you're asking which path a flow takes.

Cutting a big table down

show ip route ospf, connected, static, eigrp or bgp show one source at a time. For the shape of the table, use the summary:

R1#show ip route summary
Route Source    Networks    Subnets     Replicates  Overhead    Memory (bytes)
connected       0           5           0           560         1560
static          0           1           0           112         312
application     0           0           0           0           0
ospf 1          1           4           0           672         1580
  Intra-area: 4 Inter-area: 0 External-1: 0 External-2: 1
  NSSA External-1: 0 NSSA External-2: 0
eigrp 100       0           2           0           368         624
internal        3                                               2216
Total           4           12          0           1712        6292

Connected counts 5 (two C subnets, two L addresses and the loopback). OSPF has 1 network (the 0.0.0.0/0 default, which is why External-2 is 1) plus 4 subnets. When a table suddenly grows or shrinks, this is the quickest way to see which protocol did it.

The break: cut R1 to R2 and read the table again

I shut R1's Ethernet0/1 at 20:28:26.5 UTC and ran show ip route straight away. The routing protocols dropped their neighbours within 8 ms of each other:

*Nov 14 20:28:26.516: %OSPF-5-ADJCHG: Process 1, Nbr 198.51.100.2 on Ethernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
*Nov 14 20:28:26.524: %DUAL-5-NBRCHANGE: EIGRP-IPv4 100: Neighbor 192.0.2.2 (Ethernet0/1) is down: interface down
Gateway of last resort is 192.0.2.6 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 192.0.2.6, 00:01:35, Ethernet0/2
      192.0.2.0/24 is variably subnetted, 4 subnets, 2 masks
O        192.0.2.0/30 [110/30] via 192.0.2.6, 00:00:00, Ethernet0/2
C        192.0.2.4/30 is directly connected, Ethernet0/2
L        192.0.2.5/32 is directly connected, Ethernet0/2
O        192.0.2.8/30 [110/20] via 192.0.2.6, 00:01:35, Ethernet0/2
      198.51.100.0/32 is subnetted, 3 subnets
C        198.51.100.1 is directly connected, Loopback0
O        198.51.100.2 [110/21] via 192.0.2.6, 00:00:00, Ethernet0/2
O        198.51.100.3 [110/11] via 192.0.2.6, 00:01:35, Ethernet0/2
      203.0.113.0/24 is variably subnetted, 3 subnets, 2 masks
O        203.0.113.65/32 [110/21] via 192.0.2.6, 00:00:00, Ethernet0/2
S        203.0.113.128/26 [1/0] via 192.0.2.2
O        203.0.113.254/32 [110/11] via 192.0.2.6, 00:01:35, Ethernet0/2

Here's what changed:

What changedWhat it tells you
Routes that were replaced show 00:00:00The age column is the quickest way to see what just changed. 192.0.2.8/30 lost a next hop but kept its 00:01:35 timer, so a route that only loses an ECMP path won't stand out.
198.51.100.2 went from D [90/409600] to O [110/21] via R3The OSPF copy hidden by AD took over the moment the EIGRP route left.
203.0.113.0/26 disappearedIt was EIGRP-only. Traffic for it now matches the default route.
192.0.2.0/30 changed from C to O [110/30] via R3R1's side is down, but R2's end of the link stayed up and R2 keeps advertising the subnet into OSPF.
192.0.2.8/30 dropped to one next hopThe ECMP pair collapsed to the path via R3.
S 203.0.113.128/26 via 192.0.2.2 is still thereThis is the trap. Keep reading.

A static route that stays in the table and drops traffic

The static route still points at 192.0.2.2, and the table gives no hint of a problem, since statics print no age. But 192.0.2.2 is now reachable through OSPF via R3, so the static resolves recursively through that path. CEF shows where packets actually go:

R1#show ip route 203.0.113.190
Routing entry for 203.0.113.128/26
  Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 192.0.2.2
      Route metric is 0, traffic share count is 1

R1#show ip cef 203.0.113.190
203.0.113.128/26
  nexthop 192.0.2.6 Ethernet0/2

R1#ping 203.0.113.190 repeat 5
Success rate is 0 percent (0/5)

R1#traceroute 203.0.113.190 numeric timeout 1 probe 1 ttl 1 3
  1 192.0.2.6 3 msec
  2  *
  3  *

R1 sends the traffic to R3, and R3 has no route to 203.0.113.128/26 because it was never advertised. Every packet is lost while the routing table still shows a healthy-looking S line. The EIGRP-only network fails differently: it falls through to the default, and R3 answers with an unreachable:

R1#traceroute 203.0.113.1 numeric timeout 1 probe 1 ttl 1 2
  1 192.0.2.6 2 msec
  2 192.0.2.6 !H
⚠️
Read the RIB, then check CEF. show ip route told me the static route was fine. show ip cef showed it now leaves through Ethernet0/2, which is the wrong way. When a route looks right and traffic still fails, compare the two. See longest prefix match for how CEF picks the entry in the first place.

Recovery: how long the table takes to come back

I brought the interface back at 20:28:54.4 UTC, after a 28-second outage:

Event (UTC)TimeSince no shutdown
no shutdown entered20:28:54.420 s
Line protocol up20:28:57.362.9 s
EIGRP neighbour up, D routes back20:28:58.674.2 s
OSPF neighbour FULL20:29:01.917.5 s

EIGRP came back about 3 seconds before OSPF, which still had to go through EXSTART and LOADING on a broadcast segment. Once both were up, the table matched the baseline exactly: D 198.51.100.2 hid the OSPF copy again, 192.0.2.8/30 had both next hops, and the changed routes showed ages of 00:00:12 to 00:00:15.

The fix: tie the static route to the interface, and give it a backup

Two changes. First, name the exit interface as well as the next hop, so the route is removed when the link goes down instead of resolving through some other path. Second, advertise the network behind R2 into OSPF too (Loopback3 above), so there's a real alternative to fall back on. While the static route is installed, OSPF's copy is hidden by AD, exactly like 198.51.100.2 was.

R1(config)#no ip route 203.0.113.128 255.255.255.192 192.0.2.2
R1(config)#ip route 203.0.113.128 255.255.255.192 Ethernet0/1 192.0.2.2

R1#show ip route static
S        203.0.113.128/26 [1/0] via 192.0.2.2, Ethernet0/1

Then the same failure again, at 20:29:29.2 UTC:

R1#show ip route 203.0.113.190
Routing entry for 203.0.113.128/26
  Known via "ospf 1", distance 110, metric 21, type intra area
  Last update from 192.0.2.6 on Ethernet0/2, 00:00:01 ago
  Routing Descriptor Blocks:
  * 192.0.2.6, from 198.51.100.2, 00:00:01 ago, via Ethernet0/2
      Route metric is 21, traffic share count is 1

R1#ping 203.0.113.190 repeat 5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/3/4 ms

The static route left with the interface, OSPF's /26 via R3 took over, and the ping that failed 0/5 last time succeeded 5/5. When the link came back, the static route returned with the interface and hid OSPF's copy again.

A reading checklist

  1. Check the gateway of last resort line first. If it says not set, anything unmatched is dropped.
  2. Ignore the parent headers when counting routes.
  3. For each route you care about, read the code, then the bracket (AD/metric), then the next hop and interface.
  4. Look at the age column. Anything near 00:00:00 just changed.
  5. Use show ip route <address> for one destination, and show ip cef <address> to see where packets actually go.
  6. A static route via a next hop with no exit interface can stay installed after its link fails. Check CEF before trusting it.
  7. If a protocol's route is missing, check that protocol's database. It may be losing on AD.

FAQ

What does C mean in the routing table?

Connected. The subnet is configured on an interface that is up/up, with AD 0. Every C line has a matching L line for the router's own address, except loopback host routes.

What do the two numbers in brackets mean?

Administrative distance, then metric. [110/20] is OSPF (AD 110) with a cost of 20. [90/409600] is EIGRP with a composite metric of 409600. [1/0] is a static route.

What is the L code?

Local: the router's own interface address as a /32. It tells the router to keep packets for that address instead of forwarding them. You can't remove it on its own; it goes away when the interface address does.

Why does a static route show no timer?

IOS doesn't age static or connected routes. That's why a static route that has recursed onto the wrong path looks exactly like a healthy one.

Does show ip route work the same in Packet Tracer?

Yes. The codes, the bracket and the layout are the same as on IOS XE. Newer releases have a longer legend at the top, which you can skip.

Key takeaways

  • Each entry tells you the source, [AD/metric], next hop, age and exit interface. Parent headers are summaries, not routes.
  • The table shows winners only. A route that loses on AD stays in its protocol's database and takes over when the winner disappears.
  • OSPF advertises loopbacks as /32 unless you set ip ospf network point-to-point.
  • In the lab, a 28-second link cut reset the age on every replaced route. EIGRP was back 4.2 s after no shutdown and OSPF reached FULL at 7.5 s.
  • A static route via a bare next hop survived the failure, resolved through R3, and dropped 5/5 pings. With an exit interface and an OSPF backup, the same failure lost none.

More on choosing between sources and prefixes is in the IP Routing guide.

Read next