Run longest prefix match over four candidate routes and see exactly which one forwards a given destination.
Forwarding is not a search for the first match but for the most specific one, which is why a router with both a /8 and a /24 covering an address always uses the /24. Administrative distance and metrics never override this — they only choose between routes of identical prefix length. Most "the traffic is taking the wrong path" tickets are longest prefix match doing exactly what it should, and stepping through the candidates is the fastest way to prove whether the problem is the route table or the policy above it.
Route Lookup
A route matches when (destination AND mask) equals (network AND mask); of all matches, the one with the longest prefix is installed as the forwarding decision.
A route matches when (destination AND mask) equals (network AND mask); of all matches, the one with the longest prefix is installed as the forwarding decision. Forwarding is not a search for the first match but for the most specific one, which is why a router with both a /8 and a /24 covering an address always uses the /24. Administrative distance and metrics never override this — they only choose between routes of identical prefix length.
Most "the traffic is taking the wrong path" tickets are longest prefix match doing exactly what it should, and stepping through the candidates is the fastest way to prove whether the problem is the route table or the policy above it.
This calculator takes 5 inputs: Destination IP, Candidate route 1, Candidate route 2, Candidate route 3, Candidate route 4. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
Not for this step. Prefix length is compared first, so an OSPF /24 beats a static /16 even though static has a far better administrative distance. Distance is only used when two protocols offer the same prefix.