Exam alignment

Cisco objective 3.1 asks you to interpret routing-table components. Cisco objective 3.2 asks you to determine the default forwarding decision using longest prefix match, administrative distance, and routing protocol metric. This lesson combines both because they are operationally inseparable.

Learning Outcomes

Interpret each field in Cisco show ip route output.

Recognize common route-source codes such as L, C, S, O, D, R, and B.

Explain prefixes, subnet masks, next-hop addresses, exit interfaces, administrative distance, and metric.

Explain when and how a gateway of last resort is used.

Determine the complete routing/forwarding decision using longest prefix match, administrative distance, and routing protocol metric in the correct hierarchy.

Configure connected, static, default, and basic OSPF routes to generate realistic routing-table entries.

Use show commands, ping, traceroute, ARP, and CEF checks to troubleshoot routing problems.

Explain the control plane, data plane, RIB, FIB, and adjacency table and show how they interact during routing and forwarding.

Determine how a router forwards a packet by default: longest prefix match, default-route fallback, adjacency resolution, Layer 2 rewrite, and drop behavior when no route exists.


Suggested Study Flow

1. Understand what the routing table is and how connected, static, dynamic, and default routes enter it.

2. Learn how to read show ip route: route code, prefix/mask, next hop, exit interface, AD, and metric.

3. Understand the gateway of last resort and when the default route is used.

4. Master the complete decision hierarchy: longest prefix match first; for the same prefix compare AD; within the same protocol compare metric.

5. Learn the control plane and data plane: RIB route selection, CEF/FIB programming, adjacency resolution, and packet forwarding.

6. Walk through the default router forwarding process step by step from ingress frame to egress transmission.

7. Configure connected, static, default, and OSPF routes, then finish with verification, troubleshooting, and the enterprise lab.


1. What Is a Routing Table?

A routing table is the Layer 3 decision database a router or multilayer switch uses to determine where IP packets should be forwarded. It contains destination networks, how those networks were learned, the preferred path to each destination, and forwarding information such as a next-hop address or outgoing interface.

On Cisco IOS and IOS XE, the main operational command is show ip route. The resulting output is often called the Routing Information Base (RIB). Cisco Express Forwarding (CEF) builds a forwarding structure from the selected routes so packet forwarding can occur efficiently in the data plane.

Important distinction

The routing table is not a list of every path ever learned. It normally contains the best route or equal-cost best routes that survived protocol selection and route-source preference.


Pasted content image

Figure 1 - Routes can enter the RIB from connected interfaces, static configuration, dynamic routing, and a default route.


2. How Routes Enter the Routing Table

Route type

How it appears

How it is created

Typical example

Local

L

Automatically for each configured interface IP

L 10.10.10.1/32

Connected

C

Automatically when an interface is up/up with an IP prefix

C 10.10.10.0/24

Static

S

Configured with ip route

S 172.16.50.0/24 [1/0] via 10.0.12.2

Dynamic - OSPF

O

Learned through OSPF adjacency and LSDB calculation

O 10.30.30.0/24 [110/3] via 10.0.12.2

Default

S* / protocol-specific *

Static or dynamically learned 0.0.0.0/0

S* 0.0.0.0/0 [1/0] via 203.0.113.1

Connected and local routes appear only when the interface is operational. If the interface is administratively shut or line protocol is down, the associated connected/local routes are removed. Static routes depend on the configured next hop or interface and may also disappear if their resolution fails. Dynamic routes depend on routing-protocol operation and neighbor/path availability.


3. Reading show ip route

Example routing table

R1# show ip route

Codes: L - local, C - connected, S - static, O - OSPF

Gateway of last resort is 203.0.113.1 to network 0.0.0.0

 

C 10.10.10.0/24 is directly connected, GigabitEthernet0/0

L 10.10.10.1/32 is directly connected, GigabitEthernet0/0

C 10.0.12.0/30 is directly connected, GigabitEthernet0/1

L 10.0.12.1/32 is directly connected, GigabitEthernet0/1

O 10.20.20.0/24 [110/2] via 10.0.12.2, 00:00:35, GigabitEthernet0/1

O 10.30.30.0/24 [110/3] via 10.0.12.2, 00:00:35, GigabitEthernet0/1

S* 0.0.0.0/0 [1/0] via 203.0.113.1


Pasted content image

Figure 3 - Anatomy of an OSPF route entry.


For a learned route such as O 10.20.20.0/24 [110/2] via 10.0.12.2, the first value inside brackets is administrative distance and the second is the routing protocol metric. The next-hop address identifies the immediate Layer 3 neighbor to which the packet should be sent. The exit interface is the local interface used to reach that next hop.


4. Routing Protocol Code

The route code is the symbol at the beginning of a routing-table entry. It identifies the route source. The code is essential because it tells you whether the route came from the local device, a static configuration, OSPF, EIGRP, RIP, BGP, or another source.

Code

Meaning

Operational interpretation

L

Local

Host route to an IP address configured on the local router interface.

C

Connected

Network is directly attached to an up/up local interface.

S

Static

Route was manually configured with ip route.

O

OSPF

Route was learned through OSPF.

O IA

OSPF inter-area

Route came from a different OSPF area.

D

EIGRP

Route was learned using EIGRP.

R

RIP

Route was learned using RIP.

B

BGP

Route was learned using BGP.

*

Candidate default

The route is eligible to serve as a default route / gateway of last resort.

CCNA focus

You do not need every possible IOS route code memorized. Be comfortable identifying the major route sources and recognizing OSPF variations when they appear.


5. Prefix

A prefix is the destination network portion of a route. In 10.20.20.0/24, the destination prefix is 10.20.20.0 and the prefix length is /24. A packet does not need to have the exact destination address 10.20.20.0; any destination address that falls inside that prefix can match the route.

Route

Address range concept

Specificity

10.0.0.0/8

All addresses whose first octet is 10

8 network bits

10.10.0.0/16

Addresses beginning 10.10

16 network bits

10.10.10.0/24

Addresses beginning 10.10.10

24 network bits

10.10.10.128/25

10.10.10.128-10.10.10.255

25 network bits

0.0.0.0/0

All IPv4 destinations

0 network bits - least specific

Longer prefix lengths are more specific. This becomes critical during forwarding because a router can have several routes that all match the same destination address; the longest matching prefix is selected.

 

6. Network Mask and Prefix Length

The network mask identifies which bits of an IPv4 address represent the network prefix. Cisco routing output usually represents this as CIDR prefix length. For example, /24 is equivalent to 255.255.255.0, /30 is 255.255.255.252, and /32 identifies a single host address.

Prefix length

Dotted-decimal mask

Common use

/8

255.0.0.0

Large aggregate

/16

255.255.0.0

Medium aggregate

/24

255.255.255.0

Typical LAN

/30

255.255.255.252

Point-to-point IPv4 link

/32

255.255.255.255

Host/local route

 

Watch the distinction

Prefix is the network being reached. Prefix length/network mask defines the size of that network. A /32 local route is more specific than the connected /24 containing the same interface IP.


7. Next Hop and Exit Interface

The next hop is the address of the neighboring Layer 3 device that should receive the packet next. The next hop is not normally the final destination; it is the next router on the path. For directly connected routes, Cisco often displays “is directly connected” instead of a next-hop address.

Pasted content image

Figure 7 - Recursive next-hop resolution.


A router must be able to resolve the next-hop IP to a reachable connected path. In the example, the route to 172.16.50.0/24 points to 10.0.12.2. R1 also has a connected route to 10.0.12.0/30, so it knows that 10.0.12.2 is reachable through Gi0/1. ARP can then resolve the next-hop MAC address on Ethernet.


Verification

R1# show ip route 172.16.50.0

Routing entry for 172.16.50.0/24

 Known via "ospf 1", distance 110, metric 30

 * 10.0.12.2, from 2.2.2.2, via GigabitEthernet0/1

 

R1# show ip route 10.0.12.2

Routing entry for 10.0.12.0/30

 Known via "connected", distance 0, metric 0

 * directly connected, via GigabitEthernet0/1


8. Administrative Distance (AD)

Administrative distance is a local Cisco preference value used when the device knows the same destination prefix from different route sources. Lower AD is more trusted. AD does not travel with the packet and is not exchanged as a universal network-wide value; it is a local decision parameter on the router.


Pasted content image

Figure 8 - Same prefix, different route sources: lower administrative distance wins.


Route source

Default Cisco AD

Meaning

Connected

0

Most preferred because the network is directly attached.

Static

1

Normally preferred over dynamic protocols.

eBGP

20

External BGP route.

EIGRP internal

90

Internal EIGRP route.

OSPF

110

OSPF route.

IS-IS

115

IS-IS route.

RIP

120

RIP route.

EIGRP external

170

External EIGRP route.

iBGP

200

Internal BGP route.


Do not compare AD for different prefix lengths

A /25 OSPF route can be used over a /24 static route for destinations inside the /25 because forwarding first cares about longest prefix match. AD is relevant when competing routes describe the same prefix.


9. Routing Protocol Metric

A metric is a protocol-specific value used by a routing protocol to decide which path is best when multiple paths to the same prefix exist within that protocol. Lower is generally better for OSPF, RIP, and EIGRP, although the metric formula and meaning are different for each protocol.

Pasted content image

Figure 9 - OSPF compares OSPF cost for paths to the same prefix.


Protocol

Metric / path-selection input

Key idea

OSPF

Cost

Derived primarily from interface reference bandwidth/bandwidth relationship.

RIP

Hop count

Fewer routers/hops is better; 15 is maximum usable.

EIGRP

Composite metric

Primarily bandwidth and delay by default, with other K values available.

BGP

Path attributes

Uses a sequence of path attributes rather than a single IGP-style metric.

Never compare an OSPF cost of 20 directly with a RIP hop count of 2. The router first selects the preferred route source using administrative distance for the same prefix; metric is meaningful within the route source/protocol calculation.


10. Gateway of Last Resort

The gateway of last resort is the next hop associated with a default route. The default prefix 0.0.0.0/0 matches every IPv4 address, but…