IP Routing – Longest matching route beats directly connected routes

One thing people seem to get hung up on when remembering the golden rule of “longest matching route wins” is when looking at directly connected routes.

Consider the following network from the perspective of R1:Screenshot 20180415 085641

Assume that from R1 we ping 192.168.2.2, does the ping follow the static route or the directly connected route? Remember the AD of static routes is 1, and directly connected routes have an AD of 0.

Here’s R1’s routing table.

Let’s find out the answer via “show ip cef 192.168.2.2”

R1’s ping will go to R2 because the static route is the longest matching route. Longest matching route is preferred over everything else. Here’s the packet capture from the link between R1 and R2 to prove it.

Leave a comment

Exit mobile version