The Network Layer: Routing

the default route

Picture a small post office that knows exactly how to deliver mail to a handful of nearby towns, but for anything addressed further away it simply hands the letter to the regional sorting hub and trusts it to figure out the rest. The default route is that 'send everything else this way' rule in a router: a catch-all entry used for any destination not matched by a more specific route.

Technically the default route is written as the prefix 0.0.0.0/0 in IPv4 (or ::/0 in IPv6), a prefix with zero significant bits, so it matches every possible address. Routers choose forwarding entries by longest-prefix match — the most specific matching prefix wins — and since 0.0.0.0/0 is the least specific of all, it is only used when nothing more specific matches. A home router, for instance, typically holds just routes for the local network plus one default route pointing at the ISP: 'anything not on my LAN, send to the ISP'.

It matters because it lets edge devices and stub networks stay tiny. Your laptop and home router do not need a copy of the Internet's full routing table; they just need their local routes and a default pointing toward someone who knows more. This single entry is what 'configure your default gateway' refers to, and it is the backbone of routing in leaf parts of the network.

An honest caveat: a default route is a statement of trust, not knowledge — it says 'I do not know where this goes, but my upstream does'. It works beautifully at the edge but is meaningless in the Internet's core: routers in the default-free zone carry full routing tables precisely because there is no bigger upstream to defer to. Also, a misconfigured default route silently black-holes traffic, since the router will dutifully forward unmatched packets to a next hop that may go nowhere.

A home router's table: '192.168.1.0/24 -> local LAN' and '0.0.0.0/0 -> 203.0.113.1 (the ISP)'. A packet for 192.168.1.50 matches the LAN entry; a packet for 8.8.8.8 matches nothing specific, so it falls through to the default route toward the ISP.

0.0.0.0/0 matches everything but is least specific, so longest-prefix match uses it only as a last resort.

A default route works because it is the least specific prefix under longest-prefix match. Core Internet routers (the default-free zone) have no default — they carry full tables instead.

Also called
default gatewaygateway of last resort0.0.0.0/0預設閘道