BGP Prefer eBGP over iBGP

This topic is to discuss the following lesson:

Didnt got the AD value part
If lets say there is a router A
If it gets 2 routes of same prefix x.x.x.x/24 from ibgp and ebgp so it will select ebgp because ebgp has lower AD value of 20 compared to Ibgp which is 200 right ?
Its a bit confusing for me as i read ur notes

Hello Anoop

We must keep in mind the order of operations with which these processes take place.

The BGP router will first consider all of the possible routes that have been learned via BGP. These routes are all listed in the BGP table. From this, using the best path selection algorithm, BGP will choose the best one. Once this is done, that best path will then become a candidate to be installed in the routing table.

This candidate route will then be compared with routes to the same destination that have been learned from other routing protocols (if they exist) using the Administrative Distance. The candidate route with the lowest AD is chosen.

The note that Rene mentions in the lesson, is simply saying that the choice of eBGP over iBGP within the BGP process and the BGP table should not be confused with the process of comparing routes for the routing table using the AD.

Now having said that, we know that eBGP routes have a default AD of 20 and iBGP routes have a default AD of 200. Because the BGP best path algorithm always prefers eBGP over iBGP, you will never have a BGP router choose both an iBGP and eBGP route to the same destination as the best paths. Therefore, you will never need to compare the AD of an iBGP and eBGP route on the same router. BGP itself chooses the best path before you even get to the comparison of ADs. Does that make sense?

I hope this has been helpful!


I guess we can say the Routing Table is the World Championships and in that best athletes (routes) from different countries (routing protocols ) participate .
So to identify the best athlete in a country is the responsibility of that country
So here BGP selects the best route to reach to x.x.x.x route and iBGP and eBGP give the best route and BGP says that for us eBGP is the better route and i am not checking the AD value its because of best path selection criteria

But then in the Routing Table (World championships) x.x.x.x route is given by lots of countries like BGP,RIP,OSPF,ISIS and EIGRP and now AD value comes into picture

So inside a country we trust all citizens so not checking AD value inside a country but in world championship we have to trust a country based on their trustworthiness using AD value

I hope this is the right analogy for my understanding

Hello Anoop

Wow, that’s a great analogy! And it’s spot on! The only thing I would add is that BGP is a nation that is composed of two countries, iBGP and eBGP, in a similar way that the UK is composed of four. But only one of those two countries can compete for the nation.

BGP must have iBGP compete with eBGP if they both enter the national competition. eBGP will always win and will go to the world championships with an AD of 20. However, if eBGP does not enter the national competition at all, then iBGP wins by default, and it goes to the world championships with an AD of 200. So you will never have eBGP and iBGP compete at the world championships together…

Great job! I think I’ll use this analogy in the future too…

I hope this has been helpful!


Hello, i have a question to ask, I have looked at the configuration, but I don’t quite understand it.
Why there is no ospf configuration between R1 and R2?
Many thanks

Hello Xinran

The prerequisite that exists for Autonomous Systems within which iBGP peers are deployed, is that there must be routing established such that all iBGP routers within the AS can reach each other.

When you have a large AS with multiple routers, you would typically deploy a routing protocol like OSPF or EIGRP to ensure that this prerequisite is fulfilled. However, if you just have two routers such as those in AS12, they are directly connected, and they already know how to reach each other via their directly connected network of So the prerequisite is fulfilled without the need to deploy a routing protocol.

In a real world scenario where you would typically have dozens of iBGP peers within an AS, a routing protocol like OSPF is absolutely necessary. But for this specific situation with two routers, it is unnecessary. Does that make sense?

I hope this has been helpful!