thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Routing & Switching · Foundational

Longest Prefix Match (LPM)

The forwarding rule that the route with the most specific (longest) matching prefix is used, regardless of AD or metric.

Definition

When a destination matches several routing table entries, the router chooses the entry with the longest subnet mask. Longest match is evaluated before administrative distance or metric, because routes with different prefix lengths are different routes. Hardware performs LPM lookups in TCAM or trie structures.

Example

For destination 10.1.1.5, a static 10.1.1.0/24 route is used instead of an OSPF 10.1.0.0/16 route even though OSPF has a higher AD.

Exam tip

The order is: longest prefix, then administrative distance, then metric. Many questions hide a more specific static or summary route.

Related terms