Reading the Cisco IOS Routing Table, Line by Line

The Legend and the First Lines

The routing table is the first output most engineers learn and the last one they really master. It looks familiar after a week of study, yet a CCIE candidate is expected to read it the way a doctor reads an X-ray: every letter, bracket and timer means something. This post walks through "#show ip route" on a Cisco IOS XE router running OSPF and BGP, from the top of the output to the details of a single prefix.

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
       n - NAT, Ni - NAT inside, No - NAT outside, Nd - NAT DIA
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       H - NHRP, G - NHRP registered, g - NHRP registration summary
       o - ODR, P - periodic downloaded static route, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR
       & - replicated local route overrides by connected

Gateway of last resort is 10.1.12.2 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 10.1.12.2
      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 10.1.12.2, 00:15:31, GigabitEthernet0/0
      3.0.0.0/32 is subnetted, 1 subnets
O        3.3.3.3 [110/3] via 10.1.12.2, 00:15:31, GigabitEthernet0/0
      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.1.12.0/24 is directly connected, GigabitEthernet0/0
L        10.1.12.1/32 is directly connected, GigabitEthernet0/0
O        10.1.23.0/24 [110/2] via 10.1.12.2, 00:15:31, GigabitEthernet0/0
B        10.50.0.0/16 [20/0] via 10.1.12.2, 00:06:12
B     192.0.2.0/24 [200/0] via 3.3.3.3, 00:10:02

The legend at the top is the key to the first column. The letter in front of each route says which source installed it. C is a connected network, L is the local /32 address of the router's own interface, S is static, O is OSPF, D is EIGRP and B is BGP. Some codes add a second column of detail, such as IA for OSPF inter-area or E2 for OSPF external type 2. Two symbols are easy to miss. An asterisk marks a candidate default route, and a plus sign marks a route replicated from another table, which you will meet when VRF route leaking appears later in the course.

Below the legend, the "Gateway of last resort" line tells you which default route is in use. If it says "Gateway of last resort is not set", any packet that matches no other entry is dropped. In this output the default is a static route pointing to 10.1.12.2.

Reading Each Route Line

Once the legend is clear, each route line can be read from left to right, always in the same order. Take the OSPF route to 2.2.2.2.

The first field, O, is the source. The second, 2.2.2.2, is the destination prefix. Its mask is not on the line itself, because IOS groups routes under a parent line such as "2.0.0.0/32 is subnetted, 1 subnets". The parent line names the classful network, 2.0.0.0 here, and when all children share one mask it shows that mask once. When the children use different masks, as under 10.0.0.0/8, the parent says "variably subnetted" and every child shows its own mask. The parent lines are display grouping only. They are not routes and are never used for forwarding.

The bracket [110/2] holds two numbers that answer different questions. The first is the administrative distance, the trust level of the source, which the RIB used to install this route. The second is the metric, the cost inside that protocol. Here 110 is OSPF and 2 is the OSPF cost to reach 2.2.2.2.

After the bracket comes "via 10.1.12.2", the next hop. Then 00:15:31, the age of the route, which tells you how long ago it was last installed or updated. A route whose timer keeps resetting to a few seconds is a flapping route, and that one detail often explains a whole outage. The last field, GigabitEthernet0/0, is the outgoing interface.

The BGP lines look different, and the difference is the most important thing on the screen. Both have a bracket, a next hop and an age, but neither has an outgoing interface. The eBGP route to 10.50.0.0/16 shows [20/0], which is AD 20 for eBGP and a metric of 0, the MED it carries. The iBGP route to 192.0.2.0/24 shows [200/0], AD 200 for iBGP, and its next hop is 3.3.3.3, a loopback two routers away. BGP routes do not name an interface because their next hop is resolved recursively. To forward a packet to 192.0.2.0/24, the router first looks up 3.3.3.3, finds the OSPF route through GigabitEthernet0/0, and uses that.

Connected and local entries complete the picture. The C line for 10.1.12.0/24 says the whole subnet is on GigabitEthernet0/0. The L line for 10.1.12.1/32 is the router's own address on that subnet, installed so that packets addressed to the router itself are delivered to the control plane rather than forwarded.

Looking Deeper at a Single Prefix

The summary view is good for scanning, but troubleshooting needs the full story of one entry, and that is what "#show ip route" followed by a prefix gives you.

R1#show ip route 192.0.2.0
Routing entry for 192.0.2.0/24
  Known via "bgp 65001", distance 200, metric 0
  Tag 65100, type internal
  Last update from 3.3.3.3 00:10:02 ago
  Routing Descriptor Blocks:
  * 3.3.3.3, from 3.3.3.3, 00:10:02 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 65100
      MPLS label: none

"Known via" names the process that owns the route, here BGP AS 65001. "type internal" confirms it came from an iBGP peer. The Tag 65100 is an AS number that BGP copies from the route's AS_PATH into the routing table, and "AS Hops 1" is the AS_PATH length. Under "Routing Descriptor Blocks" each path is listed, and the asterisk marks the one currently used. With load balancing you would see several blocks, each with its own traffic share count.

A different and very useful habit is to look up an address rather than a prefix. Asking for a host address makes the router run the longest prefix match for you and tell you which entry wins.

R1#show ip route 10.50.7.9
Routing entry for 10.50.0.0/16
  Known via "bgp 65001", distance 20, metric 0
  Tag 65002, type external
  Last update from 10.1.12.2 00:06:12 ago
  Routing Descriptor Blocks:
  * 10.1.12.2, from 10.1.12.2, 00:06:12 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 65002
      MPLS label: none

The packet to 10.50.7.9 uses the /16 learned by eBGP. If the router had no match more specific than the default, the answer would show 0.0.0.0/0. Two filters complete the toolkit. The command "#show ip route bgp" lists only the routes BGP owns, and "#show ip route 10.0.0.0 255.0.0.0 longer-prefixes" lists every entry inside a range.

R1#show ip route bgp
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
       n - NAT, Ni - NAT inside, No - NAT outside, Nd - NAT DIA
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       H - NHRP, G - NHRP registered, g - NHRP registration summary
       o - ODR, P - periodic downloaded static route, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR
       & - replicated local route overrides by connected

Gateway of last resort is 10.1.12.2 to network 0.0.0.0

      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
B        10.50.0.0/16 [20/0] via 10.1.12.2, 00:06:12
B     192.0.2.0/24 [200/0] via 3.3.3.3, 00:10:02

Reading the routing table well is the foundation for everything BGP does later. When a BGP prefix is in "#show ip bgp" but not in the routing table, when a BGP line shows AD 200 where you expected 20, or when a BGP next hop has no OSPF route under it, the routing table is where you notice first. Learn to read it fluently now, and every later module becomes easier to troubleshoot.