3.1 Routing Table Components

Key Takeaways

  • The routing table contains prefix/mask, next-hop IP, outgoing interface, administrative distance, and metric.
  • Administrative distance (AD) determines which routing source is trusted most (lower AD = more trusted).
  • Directly connected routes have AD 0, static routes have AD 1, OSPF has AD 110, EIGRP has AD 90.
  • The gateway of last resort (default route 0.0.0.0/0) is used when no specific route matches.
  • Routing protocol codes: C=connected, S=static, O=OSPF, D=EIGRP, R=RIP, B=BGP.
Last updated: March 2026

Routing Table Components

The routing table is the most important data structure on a router. It contains all the information the router needs to forward packets to their destinations.

Viewing the Routing Table

Router# show ip route

Sample Routing Table Output

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, O - OSPF, IA - OSPF inter area
       * - candidate default

Gateway of last resort is 10.0.0.1 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 10.0.0.1
C     10.0.0.0/30 is directly connected, GigabitEthernet0/0
L     10.0.0.2/32 is directly connected, GigabitEthernet0/0
C     192.168.10.0/24 is directly connected, GigabitEthernet0/1
L     192.168.10.1/32 is directly connected, GigabitEthernet0/1
O     192.168.20.0/24 [110/2] via 10.0.0.1, 00:05:23, GigabitEthernet0/0
S     192.168.30.0/24 [1/0] via 10.0.0.1
D     192.168.40.0/24 [90/3072] via 10.0.0.1, 00:15:42, GigabitEthernet0/0

Route Entry Components

Each entry in the routing table contains:

ComponentExamplePurpose
Route source codeO (OSPF)How the route was learned
Destination prefix192.168.20.0Network being reached
Subnet mask / prefix length/24Defines the network boundary
Administrative distance[110/Trustworthiness of the route source
Metric/2]Cost within the routing protocol
Next-hop addressvia 10.0.0.1Where to send the packet
Route age00:05:23How long ago the route was learned
Outgoing interfaceGigabitEthernet0/0Physical interface to send the packet

Routing Protocol Codes

CodeProtocolDescription
CConnectedDirectly connected networks
LLocalIP addresses assigned to the router's own interfaces
SStaticManually configured routes
S*Static defaultDefault route (0.0.0.0/0) via static
RRIPRouting Information Protocol
DEIGRPEnhanced Interior Gateway Routing Protocol
OOSPFOpen Shortest Path First
O IAOSPF Inter-AreaOSPF route from a different area
BBGPBorder Gateway Protocol

Administrative Distance (AD)

Administrative distance measures the trustworthiness of a route source. When a router learns about the same destination from multiple sources, it uses the route with the lowest AD.

Route SourceDefault AD
Connected0
Static1
EIGRP summary5
eBGP20
EIGRP (internal)90
IGRP100
OSPF110
IS-IS115
RIP120
EIGRP (external)170
iBGP200
Unknown / Unreachable255 (never used)

On the Exam: Memorize the AD values for Connected (0), Static (1), EIGRP (90), OSPF (110), and RIP (120). These are the most commonly tested. A route with AD 255 is considered unreachable and is never installed.

Example question scenario: A router learns about network 10.1.1.0/24 via both OSPF (AD 110) and a static route (AD 1). Which route is installed? The static route because AD 1 < AD 110.

Metric

The metric is used to compare routes learned from the same routing protocol. Different protocols use different metrics:

ProtocolMetricWhat It Measures
RIPHop countNumber of routers to the destination (max 15)
OSPFCostBased on interface bandwidth (lower = better)
EIGRPCompositeBandwidth + delay (by default)
BGPPath attributesAS path length, origin, MED, local preference

Key distinction: AD compares routes from different routing protocols. Metric compares routes from the same protocol.

Gateway of Last Resort (Default Route)

The gateway of last resort is the default route (0.0.0.0/0). When a packet's destination doesn't match any specific route in the routing table, the router forwards it to the default gateway.

Router(config)# ip route 0.0.0.0 0.0.0.0 10.0.0.1        ! Static default route

The 0.0.0.0/0 route matches every possible destination because it has 0 network bits—meaning all bits are host bits. However, it is always the least preferred match due to the longest prefix match rule.

Longest Prefix Match

When multiple routes match a destination, the router uses the longest prefix match (most specific route):

Example: A packet destined for 192.168.10.50. The routing table has:

  • 0.0.0.0/0 → via 10.0.0.1 (matches — 0 bits)
  • 192.168.10.0/24 → via 10.0.0.2 (matches — 24 bits)
  • 192.168.10.48/28 → via 10.0.0.3 (matches — 28 bits)

The router uses 192.168.10.48/28 because /28 is the longest (most specific) match.

On the Exam: Longest prefix match is a fundamental concept. If a /32 route exists for a specific host, it will always be preferred over any less specific route for the same address. The routing decision process: longest prefix match first, then AD, then metric.

Test Your Knowledge

Which route would a router prefer if it learns about 10.1.1.0/24 from both OSPF (AD 110) and EIGRP (AD 90)?

A
B
C
D
Test Your Knowledge

A router has these routes: 10.0.0.0/8, 10.1.0.0/16, and 10.1.1.0/24. A packet arrives destined for 10.1.1.50. Which route does the router use?

A
B
C
D
Test Your Knowledge

What is the administrative distance of a directly connected route?

A
B
C
D