What longest prefix match is
The prefix length is the number after the slash, like /24. It says how many bits at the start of the address must match. A bigger number means a smaller, more specific network.
A packet's destination can match several routes at once. Longest prefix match is the rule: the router uses the matching route with the longest prefix. Other details, like which protocol the route came from, don't matter at this stage.
3 installed prefixes match. /24 is the longest match, so R1 uses next hop 10.0.13.2.
Why the most specific route wins
A more specific route is usually a deliberate exception. Someone summarised all company LANs as 192.168.0.0/16, then added a /24 because one site has a better path. If the broad route won, the exception would never be used.
The flip side shows up in troubleshooting. When traffic takes a path nobody expects, the cause is often a more specific route left over from a test or a migration, quietly beating the summary everyone is looking at.
To check a match, compare only the first n bits. For the /25, the first three octets must be 192.168.3 and the first bit of the last octet must be 1 (values 128–255):
Forwarding chooses among routes already installed. Administrative distance and protocol path selection determine installation; they are not extra comparisons made for each packet.
Asking the router which route it would use
Give show ip route an address, and the router tells you which matching route is present in the routing table. This Cisco IOS XE 17.x-style privileged EXEC example is authored from documentation, not run on a lab device. Output details depend on the image. Forwarding uses the programmed forwarding table; a route lookup alone does not prove that a next hop or application is working.
R1#show ip route 192.168.3.200 Routing entry for 192.168.3.128/25 Known via "static", distance 1, metric 0 Routing Descriptor Blocks: * 10.0.12.2 Route metric is 0, traffic share count is 1
Try the boundary, then remove the fallback
Use the explorer as a small route-lookup lab. Select 192.168.3.127, then 192.168.3.128. The first destination chooses R3 through the /24; the second chooses R2 through the /25. The /25 covers values 128–255 in the last octet. This is a bit-match demonstration: the network and broadcast addresses in that range are not ordinary host addresses.
Select 198.51.100.7 and note the default route. Clear Include the installed default route: none of this model’s remaining prefixes matches, so R1 drops the packet. Select 192.168.3.200 while the default is absent; the /25 still works. Restore the checkbox and verify that 198.51.100.7 uses the default again.
Removing a fallback does not remove a more specific matching route. This explorer assumes its listed routes are installed and usable; it does not emulate next-hop resolution, interfaces, return paths or a real router. On a device, inspect the destination lookup and forwarding/next-hop state before changing any route.
Test yourself on longest prefix match
The model’s default route is removed. What happens to destination 198.51.100.7?
Using the table above, where does R1 send a packet for 192.168.3.127?
A router has 10.0.0.0/8 learned by OSPF and 10.1.1.0/24 as a static route. Which is used for 10.1.1.5?
Cisco reference: Route installation, administrative distance and forwarding.