IP Connectivity · Topic 1 of 5

Components of the Routing Table

Learn to read a Cisco routing table entry: route code, prefix, mask, next hop, administrative distance, metric and the gateway of last resort.

  • 6 min
  • Exam objective 3.1
In a nutshell
  • Each route has a code, a prefix, a mask, a next hop and an outgoing interface.
  • In [110/20], 110 is the administrative distance and 20 is the metric.
  • Lower administrative distance is more trusted. Connected is 0 and static is 1.

What it is

The routing table is the list of networks a router knows how to reach, and where to send packets for each one.

Every forwarding decision a router makes starts here. If you can read a routing table line by line, you can tell how a router learned a route, how trustworthy that route is and where it will send the traffic.

You can display the table with show ip route. For IPv6, use show ipv6 route.

How it works

Each line in the table is one route, made of a few parts that you read from left to right.

Reading a route entry

Here is an example of a table, trimmed down:

Codes: L - local, C - connected, S - static, O - OSPF, D - EIGRP, * - candidate default

Gateway of last resort is 203.0.113.2 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 203.0.113.2
      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C        10.1.1.0/24 is directly connected, GigabitEthernet0/0
L        10.1.1.1/32 is directly connected, GigabitEthernet0/0
O        10.2.2.0/24 [110/20] via 10.1.1.2, 00:05:12, GigabitEthernet0/0

Take the OSPF line apart:

O 10.2.2.0/24 [110/20] via 10.1.1.2, 00:05:12, GigabitEthernet0/0

Code Olearned by OSPFprefix and mask10.2.2.0/24destination rangebrackets110 and 20AD then metricvia10.1.1.2next hop
  • Route code (O): how the router learned the route. Here, by OSPF.
  • Prefix (10.2.2.0): the destination network.
  • Network mask (/24): the length of the prefix. Together with the prefix, it defines the destination range.
  • Administrative distance (110): the first number in the brackets. It says how trustworthy the source of the route is.
  • Metric (20): the second number in the brackets. It says how good the route is within its own protocol.
  • Next hop (via 10.1.1.2): the address of the next router to send the packet to.
  • Age (00:05:12): how long the route has been known.
  • Outgoing interface (GigabitEthernet0/0): the interface the router uses to send the packet.
Watch out

In [110/20] the first number is the administrative distance and the second is the metric. Swapping them is a common reading error.

Route codes

These are the codes you will meet most often.

  • C: a directly connected network, from an interface with an address that is up.
  • L: the local address of the interface itself, shown as a /32 host route.
  • S: a static route that an administrator configured.
  • O: learned through OSPF. Variants such as O IA (inter-area) and O E2 (external) also exist.
  • D: learned through EIGRP.
  • R: learned through RIP.
  • B: learned through BGP.
  • \*: a candidate default route. It appears with another letter, as in S*.

Administrative distance

When a router learns the same destination from different sources, it must choose between them.

Administrative distance (AD) is the tie-breaker between sources. A lower number is more trusted.

SourceDefault AD
Directly connected0
Static route1
eBGP20
EIGRP (internal)90
OSPF110
IS-IS115
RIP120
EIGRP (external)170
iBGP200

The table lists the values worth memorising. Other sources, such as EIGRP summary routes, have their own values.

Metric

The metric compares routes that came from the same protocol, and each protocol calculates it differently.

  • RIP counts hops.
  • OSPF uses cost, which is based on bandwidth.
  • EIGRP uses a combined value that mainly depends on bandwidth and delay.

The cost of an OSPF interface is the reference bandwidth divided by the interface bandwidth. The default reference bandwidth is 100 Mbps, so a 100 Mbps link costs 1, and a 10 Mbps link costs 10. A 1 Gbps link also costs 1, because the lowest cost is 1.

A metric from one protocol means nothing to another. You cannot compare an OSPF cost of 20 with a RIP hop count of 3. That is why AD exists.

The gateway of last resort

The line Gateway of last resort is 203.0.113.2 to network 0.0.0.0 names the default route, which is where the router sends packets that match no other route.

Packetno matching routeuses default routeRouterS* 0.0.0.0/0sent to203.0.113.2gateway of last resort

It is usually a route to 0.0.0.0/0. If no default route exists, the line says the gateway of last resort is not set, and the router drops packets with an unknown destination.

Useful variations

A few forms of the command narrow the output.

show ip route
show ip route ospf
show ip route 10.2.2.0
show ip route connected

Adding a protocol shows only those routes. Adding an address shows the route that would match that destination, including how it was learned.

What to remember for the exam

Eight facts cover most routing table questions.

  • Each route has a code, a prefix, a mask, a next hop and an outgoing interface.
  • In [110/20], 110 is the administrative distance and 20 is the metric.
  • Lower administrative distance is more trusted. Connected is 0 and static is 1.
  • OSPF has an AD of 110, RIP 120, EIGRP internal 90 and eBGP 20.
  • A metric is compared only between routes from the same protocol.
  • OSPF cost comes from bandwidth. RIP uses hop count.
  • C is a connected network and L is the local interface address.
  • The gateway of last resort is the default route, shown as S* or similar.
Exam tip

To find which source a router trusts most, compare the first number in the brackets and pick the lowest.

Common mistakes

These five errors come up again and again.

Mixing up AD and metric. They are the two numbers in the brackets. The first is AD, and the second is the metric.

Comparing metrics across protocols. An OSPF cost cannot be compared with an EIGRP metric. The AD decides between sources.

Ignoring the L routes. They are normal and show the router's own addresses. They are not extra networks.

Reading the next hop as the final destination. The next hop is only the next router on the path.

Assuming there is a default route. If the gateway of last resort is not set, traffic for unknown networks is dropped.

Check yourself

Work through these three prompts.

  • What does each part of O 10.2.2.0/24 [110/20] via 10.1.1.2 mean?

    O means learned by OSPF, 10.2.2.0/24 is the destination network, 110 is the administrative distance, 20 is the metric and 10.1.1.2 is the next hop.

  • How do administrative distance and metric differ in use?

    Administrative distance is the tie-breaker between different route sources, and lower is more trusted. The metric compares routes from the same protocol.

  • What is the gateway of last resort, and how can you tell whether one exists?

    It is the default route, used for packets that match no other route. The Gateway of last resort line in show ip route names it or says it is not set.

Topic 1 of 5 in IP Connectivity

Test yourself on IP Connectivity

The full Cisco CCNA 200-301 question bank has 1,206 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.