The Decision Every Packet Triggers
When a device has a packet to send, it reads the destination IP address and consults its routing table to decide the next hop — the immediate neighbour to hand the packet to — and the interface to send it on. The device does not need to know the entire path to the destination, only the next step. That packet is then handed to the next hop, which performs the very same lookup in its table, and so on across the internet. Routing is a relay of independent local decisions, never one device plotting the whole journey.
A routing table entry typically contains four things:
- Destination network — a network expressed in CIDR notation, such as
192.168.1.0/24. - Next hop / gateway — the IP address of the neighbouring router to forward to (or "directly connected" if the destination is on the local link).
- Interface — which physical or virtual port to send out of.
- Metric — a cost used to break ties when more than one route could reach the same place.
A Real (Simplified) Table
Here is what a small router's table might look like conceptually:
| Destination | Next hop | Interface | Meaning |
|---|---|---|---|
192.168.1.0/24 | directly connected | LAN | The local network — deliver on this link. |
10.0.0.0/8 | 192.168.1.2 | LAN | Reach the internal 10.x network via that router. |
0.0.0.0/0 | 203.0.113.1 | WAN | Everything else — send to the ISP (default route). |
Most home devices have a tiny table: one entry for the local subnet and one default route pointing at the home router. The router that runs the global internet, by contrast, holds close to a million entries — one for every network announced across the world.
The Default Route: "If You Don't Know, Send It Here"
No device can hold a route to every network on earth, and home devices do not try. Instead they rely on the default route, written 0.0.0.0/0 — a wildcard that matches any destination. When a packet's destination matches no more specific entry, the device sends it to the default route's next hop, which on a home network is the default gateway (your router). The router in turn has its own default route pointing at the ISP. This chain of "I don't know exactly, but I know who might" is what lets a laptop with three table entries reach any of the internet's millions of networks.
Longest Prefix Match: Most Specific Wins
What happens when more than one entry matches? Suppose a packet is bound for 10.0.5.20 and the table contains both 10.0.0.0/8 and 10.0.5.0/24. Both match. The router applies longest prefix match: it chooses the entry with the longest network prefix — the most specific one — which is the /24. A larger prefix length means a narrower, more precise range, so the /24 (256 addresses) beats the /8 (16 million addresses).
The default route is the logical floor of this rule: at /0 it is the least specific possible entry, so it only wins when literally nothing else matches. Longest prefix match is why you can have a broad route to a whole region and a narrow exception for one subnet, and trust that the exception always takes precedence.
How Entries Get There
Routes arrive in a table three ways:
- Directly connected — networks the device is physically attached to are added automatically.
- Static routes — entries an administrator types in by hand, fixed until changed.
- Dynamic routes — entries learned automatically from a routing protocol. Inside one organisation that might be OSPF; across the global internet it is BGP, which lets every autonomous system advertise the networks it can reach.
Dynamic routing is what makes the internet resilient: when a link fails, the protocol recomputes and the affected entries change to route around the outage, all without human intervention. The broader picture of how these decisions chain together is covered in how internet routing works.
See Your Own Routing Table
You can inspect the table on the device you are reading this on:
- Windows:
route printornetstat -r - macOS:
netstat -rn - Linux:
ip route(ornetstat -rn)
Look for the line whose destination is 0.0.0.0 or default — its gateway is your router's IP, and that single entry is the door through which all your internet traffic leaves. Everything else in the list is either a directly connected network or a more specific exception. One last distinction worth keeping straight: the routing table decides the next-hop IP, while the ARP table then resolves that IP to a hardware MAC address so the frame can actually be delivered on the local link. Routing picks the path; ARP carries it the final step of each hop.
Frequently Asked Questions
What is a routing table?
A set of rules on a device that maps destination networks to the next hop or interface a packet should use. Every IP-capable device has one and consults it for each outgoing packet.
What is the default route?
0.0.0.0/0 — the catch-all entry used when no more specific route matches. On a home device it points at the router, sending unrecognised traffic out toward the wider internet.
What is longest prefix match?
When several entries match a destination, the router picks the most specific one — the longest prefix. A /24 beats a /8; the default /0 is chosen only when nothing else matches.
How do I view the routing table on my computer?
Windows: route print or netstat -r. macOS/Linux: netstat -rn, or ip route on Linux. The default / 0.0.0.0 line shows your gateway.
What is the difference between a routing table and an ARP table?
The routing table (Layer 3) chooses the next-hop IP and interface to reach a network; the ARP table (Layer 2) maps that next-hop IP to a MAC address so the frame can be delivered on the local link.