Lesson

Routing, Routing Tables and Default Routes

Learning objective

Read a basic routing table and choose a route using longest-prefix match and administrative/metric concepts at the appropriate depth.

Learning objective

Read IPv4 and IPv6 routing tables, apply route-selection rules in the correct order, and explain how a router forwards or discards a packet at each hop.

Why routing exists

Ethernet delivers a frame on one local Layer 2 domain. Routing moves an IP packet between Layer 3 networks. A host sends an off-link packet to a router, and each router independently chooses where that packet should go next. A route is a forwarding instruction, not a record of the whole end-to-end journey.

Route-table anatomy

A useful route entry names a destination prefix, a route source, an outgoing interface, and—when another router must receive the packet—a next-hop address. It can also carry an administrative distance and metric. Read the entry as: “For destinations inside this prefix, use this interface and, if present, send toward this next hop.”

Connected, static, learned, and default routes

  • A connected route appears because the router has an active interface in that network.
  • A static route is configured deliberately by an administrator.
  • A learned route arrives through a routing protocol.
  • A default route (0.0.0.0/0 or ::/0) is the least-specific match and is used only when no more-specific route wins.

The source explains how the router learned the route; it does not override longest-prefix matching.

How prefix matching works

The router first keeps routes from the destination's address family, then checks whether the destination bits match each route prefix. An IPv4 destination is never evaluated against an IPv6 route, and an IPv6 destination is never evaluated against an IPv4 route.

Interactive route selection

Change the scenario and watch the same decision order: address family, prefix match, longest prefix, administrative distance, comparable metric, then forwarding result. Rejected rows remain visible so the reason is inspectable.

Choose the route in the correct order

Choose a routing-table scenario

Destination: 192.0.2.20 (IPV4)

Step 1 of 6: Address family

Routes considered for Connected IPv4 network
SourcePrefixNext hopOutgoing interfaceAdministrative distanceMetricDecision
connected192.0.2.0/24Directly connectedGi0/000Retained: Address family matches
default0.0.0.0/0198.51.100.1Gi0/110Retained: Address family matches

Longest-prefix match

Among matching routes, the route with the greatest prefix length is most specific and wins. A /32 IPv4 or /128 IPv6 host route beats a shorter network route, and either beats a /0 default. The router does not prefer a default merely because it is static.

Administrative distance

If multiple route sources offer the same prefix length, administrative distance expresses the local router's preference for those sources. Lower is preferred. Administrative distance is locally significant and vendor defaults can differ, so compare it only after family, matching, and prefix length.

Route metric

If routes to the same prefix remain tied within a comparable routing source, its metric chooses the preferred path; lower commonly wins. Metrics from different protocols may measure different things and should not be compared as if they shared one scale. Equal-cost routes can support ECMP, previewed here without covering platform-specific load sharing.

Next hop and outgoing interface

The outgoing interface identifies the link the packet will leave. The next hop identifies the adjacent router that should receive it. A directly connected route may need only an interface because the destination itself is on that link. Before transmission, the router resolves the Layer 2 address needed on that outgoing link.

Interactive hop-by-hop forwarding

Follow successful and failed journeys. At every routed hop, the destination IP address does not change, the Layer 2 header is replaced for the new link, and the IPv4 TTL or IPv6 Hop Limit decreases exactly once. Each router performs a fresh lookup in its own routing table.

Follow the packet one router at a time

Choose a forwarding journey

Follow a IPv4 packet across two routers.

IPv4 routed deliveryTopology order: Source, Router 1, Router 2, Destination. Current step: 1. Router 1 receives the frame. Router 1 removes the incoming Layer 2 header; the IP destination still names the final host.Sourcesending hostRouter 1first-hop routerRouter 2next routerDestinationreceiving host
  • Source: Host eth0Router 1: R1 Gi0/0
  • Router 1: R1 Gi0/1Router 2: R2 Gi0/0
  • Router 2: R2 Gi0/1Destination: Destination eth0

Active: Source, Router 1; link Source to Router 1

Step 1 of 6

1. Router 1 receives the frame

Router 1 removes the incoming Layer 2 header; the IP destination still names the final host.

Direction: host → r1.

Packet inspector

Inside the packet

Choose packet inspection depth

Ethernet frame

IP packet

IP source
192.0.2.10
IP destination
203.0.113.20
TTL
64
Layer 2 source
00:11:22:33:44:10
Layer 2 destination
00:11:22:33:44:01
Technical packet details
Selected route
No route selected
Selected next hop
No next hop selected
Selected outgoing interface
No outgoing interface selected
Ingress
host
Egress
r1

IPv4 and IPv6 routing

IPv4 and IPv6 use separate route families but the foundational selection method is the same: match the destination, prefer the longest prefix, then resolve genuine ties using route preference and a comparable metric. IPv4 decrements TTL; IPv6 decrements Hop Limit. Their neighbour-resolution and control-message details differ.

No route and packet disposal

If no specific route and no usable default route match, there is no usable route: the router cannot forward the packet and discards it. It may generate ICMP Destination Unreachable for IPv4 or ICMPv6 Destination Unreachable for IPv6, but policy, rate limiting, reachability, or filtering can prevent that response. Silence alone does not prove the discard reason.

Free account

Continue this lesson for free

Unlock the remaining explanation, Wireshark checks, quizzes, interview answers, and saved progress. No payment required.

Continue with Google or email
Routing Tables and Default Routes