Last updated · reviewed for accuracy

How routing decisions work

A router’s whole job is one lookup: compare the destination address against a table of prefixes and forward out the interface of the longest match. More specific always beats more general, and the humble 0.0.0.0/0 default route catches everything nobody else claimed.

longest prefix wins

Once longest-prefix-match clicks, routing stops being magic. The rest of the track is just different ways of filling that table.