Many Routes One Destination
A router holds a routing table of network prefixes, each pointing to a next hop. A single destination address often matches several entries at once, so the router needs a rule to choose.
The Rule Of Specificity
The router applies longest prefix match: among all entries whose prefix contains the destination, it picks the one with the longest prefix length, meaning the most specific network.
- A default route matches everything but is the least specific.
- A wider prefix covers a large block of addresses.
- A narrower prefix covers a small block and wins when it matches.
A more specific route therefore overrides a broader one for the addresses it covers.
Why This Matters
Longest prefix match lets networks express both broad defaults and precise exceptions in one table.
- A provider can route a whole region with one wide prefix.
- A single customer block can be steered differently with a narrow prefix.
- The default route catches anything no specific entry covers.
In Practice
Routers use specialized data structures so this lookup runs fast even with hundreds of thousands of routes. The result is a consistent, predictable choice for every packet regardless of how many entries overlap.
Key idea
When several routes match a destination, longest prefix match selects the most specific prefix, letting one table hold broad defaults and precise exceptions together.