Longest Prefix Match vs AD

I would like to clarify the following information on Routing tables.

  1. Installing Routes:
    a. When a router learns routes from different routing protocols with the same prefix length, then the routing protocol become the tie-breaker?
    Example: OSPF: 10.1.1.0 /22 and RIP: 10.1.1.0 /22

b. When a router learns routes from different routing protocols with different prefix lengths, then the router sees them as 2 different routes to different destinations though they overlap. In that case, router installs both routes onto the Routing table?
Example: OSPF: 10.1.1.0 /20 and RIP: 10.1.1.0 /22

C. If 2 routes are already in the routing table, OSPF: 10.1.1.0 /20 and RIP: 10.1.1.0 /22, and if a packet with the destination 10.1.1.100, then the longest prefix match would apply even though OSPF’s AD is lower?

Please confirm.

Hello Adhithya

Yes that is correct. To be completely accurate, it is the Administrative Distance (AD) of the routing protocols that are used to determine which route will be installed.

Yes, that is correct.

Yes, you’ve got it!

Take a look at these NetworkLessons notes for more information:

I hope this has been helpful!

Laz