What routing is and where it begins
Routing is the process of deciding where an IP packet should go when its destination is not on the same directly connected network as the sender. Inside one Layer 2 domain, switches forward Ethernet frames. When the destination belongs to another IP prefix, a router or Layer 3 switching function must make the next decision.
The basic workflow is straightforward: a router receives a packet, examines the destination IP address, looks up routing information, selects a next hop or outgoing interface, and then re-encapsulates the packet for the next link. For IPv4 routers, RFC 1812 describes this forwarding behavior and the principle of selecting the most specific matching route.
Control plane and data plane
It helps to separate two problems. The control plane learns, receives, or calculates routes. It can install connected networks, static routes, or information learned from dynamic routing protocols such as OSPF. The data plane then forwards individual packets using the information that has already been selected and programmed.
Many systems use the terms RIB for the routing information base and FIB for the forwarding structure optimized for packet lookup. The exact implementation differs by platform, but the distinction is valuable: one process decides which routes are valid and preferred, while another applies those decisions at forwarding speed. The routing table guide explains this in detail.
Directly connected networks
When a Layer 3 interface has a valid address and prefix and the interface is operational, the device knows the network attached to that interface directly. These connected routes form the foundation for everything else. If a router owns 192.0.2.1/24 on one interface, it knows that destinations in 192.0.2.0/24 are on that link and do not need another router as an intermediate hop.
Final delivery on Ethernet still requires link-layer resolution. IPv4 normally uses ARP, while IPv6 uses Neighbor Discovery. Routing therefore does not replace Layer 2; it depends on it. Review MAC addressing and ARP if that relationship is not yet clear.
The routing table is a map of prefixes
A routing table is not a list of every possible host. Its entries describe prefixes, such as 10.20.0.0/16, 10.20.30.0/24, or the IPv4 default route 0.0.0.0/0. An entry can point to a next-hop address, an outgoing interface, or both, depending on the route type and platform.
Routes also carry information about where they came from and how competing candidates are compared. Keep that selection stage separate from packet forwarding. First the system decides which routes become active; then a destination lookup chooses the most specific matching active prefix.
Longest Prefix Match: the most specific route wins
If a destination matches several installed routes, the router applies Longest Prefix Match. Consider 10.0.0.0/8, 10.20.0.0/16, and 10.20.30.0/24. A packet for 10.20.30.45 matches all three, but /24 is the most specific entry and therefore wins the forwarding lookup.
This also explains why a default route does not override specific routes. A /0 matches everything, but it is less specific than any longer matching prefix. It also explains how a summarized route can coexist with more-specific exceptions.
Where a route comes from
Connected routes originate from active Layer 3 interfaces. Static routes are configured explicitly by an administrator or automation system. Dynamic routes are learned through a routing protocol, for example OSPF inside an organization or BGP between routing domains.
When several sources propose the same destination prefix, the device needs rules for choosing which candidate is installed. Cisco platforms, for example, use administrative distance to compare route sources and protocol-specific metrics to compare candidates inside one protocol. Those details are platform behavior, not a universal property of IP.
Default routes and stub networks
A default route means “if nothing more specific matches, send the packet this way.” IPv4 represents it as 0.0.0.0/0; IPv6 uses ::/0. Default routes are particularly useful in stub networks that have one logical exit because they avoid carrying many prefixes that would all lead to the same next hop.
A default route is not proof of end-to-end reachability. The next hop must itself be reachable, and every router farther along the path must know how to continue. Troubleshooting must validate the chain rather than stopping after seeing a /0 entry.
Metrics, preferences, and ECMP
Dynamic routing protocols calculate metrics according to their own rules. OSPF uses cost; other protocols use different attributes or policy systems. When multiple equal-cost paths to the same prefix are eligible, many routers can install several next hops and use Equal-Cost Multi-Path (ECMP).
ECMP does not necessarily alternate every packet across links. Implementations often hash flows so packets belonging to one flow follow the same path and arrive in order. The exact fields used in the hash and the number of installed paths depend on hardware and software.
What happens when routing loops
A routing error can make routers send a packet in circles. IPv4 uses TTL and IPv6 uses Hop Limit to bound the number of Layer 3 hops a packet can cross. Each router decrements the value; when it reaches zero, the packet is discarded. This prevents a loop from consuming resources forever, but it does not fix the faulty routing state.
Routing loops are investigated by checking active routes, redistribution, summaries, defaults, policy changes, and recent failures. Traceroute deliberately uses TTL/Hop Limit behavior to reveal intermediate hops and is therefore useful during this investigation.
IPv4 and IPv6 routing
The same prefix and longest-match logic exists in both address families, even though the tables and operational mechanisms can be separate. IPv4 uses 32-bit addresses. IPv6 uses 128-bit addresses and prefixes such as 2001:db8:1200::/48. The IPv6 guide covers addressing, link-local operation, Neighbor Discovery, and SLAAC.
A dual-stack router can maintain IPv4 and IPv6 routes at the same time. Successful connectivity in one family does not imply that the other family is configured correctly.
Routing design: keep detail where it matters and summarize where it helps
A scalable routing design carries enough detail to make correct decisions without distributing unnecessary information everywhere. Hierarchical addressing, route summarization, and clear boundaries between areas or routing domains all support that goal.
The supernetting and route summarization guide shows how several prefixes can sometimes be represented by one aggregate and why a summary must be designed carefully if it covers addresses that are not actually reachable behind the summarizing router.
Basic routing troubleshooting
When a destination is unreachable, start with addressing, prefix length, and interface state. Then confirm that the router has a route matching the exact destination and that the selected next hop can be resolved. Finally, check the return path: a correct forward route is useless if the response cannot find its way back.
- Is there a matching route?
- Is there an unexpected more-specific route?
- Is the selected next hop reachable?
- Is the outgoing interface operational?
- Are ACLs, NAT, or policy changing the traffic?
- Does a valid return route exist?
Learning path for the routing cluster
Continue with routing tables so you can read real forwarding information. Then study static routes, move to OSPF for dynamic routing, review NAT/PAT at network edges, and finish with route summarization.
If prefixes still feel abstract, revisit subnetting. Modern routing tables are built from CIDR prefixes, so subnetting knowledge is a practical prerequisite rather than a separate topic.