LOGBOOK

HELP

Quiz Entry - updated: 2026.07.05

What is a default route, and how does the longest-prefix-match rule make it the "gateway of last resort"?

A default route — 0.0.0.0/0 for IPv4 or ::/0 for IPv6 — matches every destination, but with a prefix length of /0 it requires zero matching bits. So under longest-prefix match it is the least specific route possible and is only chosen when no more-specific route matches: the gateway of last resort.

Lookup flow: use the longest specific match; else the default route; else drop.

* How a default route fits the longest-match lookup. *

Why /0 means "match anything, but lose to everything":

  • The prefix length says how many far-left bits must match. A /0 prefix demands 0 bits — so every destination IP matches it.
  • But longest-prefix match always prefers the route with the most matching bits. Any real route (a /8, /24, /28…) is longer than /0, so it always wins over the default.
  • The result: the default route catches only the traffic that nothing else does — exactly the "send everything I don't recognise this way" behaviour you want at a network edge.

Where it comes from:

  • It can be manually configured as a static route (e.g. ip route 0.0.0.0 0.0.0.0 <next-hop>), or
  • learned dynamically from a routing protocol that advertises a default.

How it shows in the table: a candidate default route is flagged with * (e.g. S*), and the router reports Gateway of Last Resort is <next-hop>. If no default is set, the output reads Gateway of Last Resort is not set and unmatched packets are dropped.

Tip: A default route is the routing equivalent of "if you don't know where it goes, send it to the post office." It's the single most common static route — edge routers point 0.0.0.0/0 at the ISP so they don't need a route for the entire internet.

Go deeper:

From Quiz: NETW2 / Routing Concepts | Updated: Jul 05, 2026