Internal BGP (Border Gateway Protocol) explained

Hello Kenny

Actually, iBGP AD is 200 and eBGP AD is 20, which means that a route learned via eBGP will take precedence over the same route being learned via iBGP. This is the case in order to prevent loops.

If a BGP router learns the same route from an eBGP neighbor AND an iBGP neighbor, it will always prefer eBGP based on the default AD. Why? Because if a route is advertised via eBGP, then it can never have originated within the local AS, therefore it considered the route learned via iBGP (from the local AS) as incorrect, or at least as less reliable. This is because of BGP’s loop prevention mechanism which eliminates any routes that contain its own AS.

For example, if route 1.1.1.1/24 within AS1 is advertised to other ASes, any eBGP router that receives an advertisement containing this destination will remove it because it contains AS1 (its own AS) as part of the path. Therefore, because of this mechanism, it is considered impossible for an eBGP router to receive an eBGP advertisement about a route that is found within its own AS. Therefore, any routes advertised via eBGP are considered by default outside of the local AS. So if the same route is advertised via iBGP, it considers that less reliable than the eBGP route.

Now in your specific scenario, the problem is not the AD of BGP routes, but the fact that 3.3.3.0/24 is not unique. This is a fundamentally flawed network implementation that should never be configured. If you did have such a case, and you wanted R2 to learn the network via iBGP and not via eBGP, then you could simply change the AD, but the fundamental problem of network operation would still remain, again not because of the way that BGP behaves, but because of duplicate IP addresses.

I hope this has been helpful!

Laz