Longest prefix match, also known as Maximum prefix length match is an algorithm used by routers in Internet protocol to select the route from routing table.
In generic it states that if there are multiple route for a single destination, route with the longest/maximum prefix will be selected to forward the incoming packet matching that route.
Example:
router# show ip route …. D 192.168.32.0/26 [90/25789217] via 10.1.1.1 R 192.168.32.0/24 [120/4] via 10.1.1.2 O 192.168.32.0/19 [110/229840] via 10.1.1.3 ….Range of IP address supported for each route:
192.168.32.0/26 Range: 192.168.32.1 to 192.168.32.63 NH: 10.1.1.1 192.168.32.0/24 Range: 192.168.32.1 to 192.168.32.254 NH: 10.1.1.2 192.168.32.0/19 Range: 192.168.32.1 to 192.168.63.254 NH: 10.1.1.3Scenarios:
- If a packet comes with destination address 192.168.32.10, it falls under all the three routes but the route selected will be that with maximum prefix length(192.168.32.0/26) with next hop 10.1.1.1
- If a packet comes with destination address 192.168.32.100, if falls under second and third routes, once again routes with maximum prefix(192.168.32.0/24) with next hop 10.1.1.2 will be selected to forward the packet.
Categories: Networking
Leave a Reply