longest prefix match

The rule that when several routes match a destination, the one with the longest prefix, the most specific, wins.

In more detail

A /24 route beats a /16, and anything beats the /0 default route. This lets a host send local traffic directly while everything else goes to the gateway.

Example

In AWS: The routing rule that, when several routes match a destination, the one with the smallest range wins.

Related terms

Taught in

References