External paths are preferred over internal paths..
Let's go through a practical example and see how it is really working..
As illustrated in the diagram, R1 and R2 are in AS 100 and R3 is in AS 300.
EIGRP is configured on all inter router links and Loopback 0s for underlay routing and following snippets show the BGP configuration on all routers.
Only the Loopback 1 which is 33.33.33.33/32 is configured in R3 and it is advertised to both its eBGP peers.
R1 and R2 will exchange this route via their iBGP neighborship.
Let's see the BGP tables of both R1 and R2 now..
As you can see the best path for 33.33.33.33/32 on both routers is the eBGP learned route. This is because the eBGP route is more preferred than the iBGP route. But you can see the Local Preference is 100 for the iBGP route and as we know the Local Preference should be considered before the Path Type; shouldn't the iBGP route be chosen to be the best path?
This leads to a confusion as some people think eBGP route is more preferred over the iBGP route because eBGP has AD of 20 and iBGP has AD of 200 and in a case like this BGP best path selection process is ignored.
But this is not true..
Then what is happening here? Let's query the route attributes on the BGP rib for this route on R2,
As you can see there is a hidden Local Preference value and it is is also 100. Which means it will narrow down to the 7th attribute and eBGP route is preferred over iBGP route..
To verify this theory I am changing the Local Preference of R1 advertising routes and see what happens..
R1(config)#router bgp 100
R1(config-router)#bgp default local-preference 500
Now the Local Preference is higher from iBGP route and it is chosen..
To understand the Local Preference route selection please go here.
Conclusion:-
Note that if you change the Local Preference from the eBGP neighbor, it will not make a change in R1 or R2 as Local Preference is advertised only to iBGP peers. But you can see that for all the routes learned (regardless of type of the neighbor), Local Preference is set to 100 by default even though it is not showing in the BGP table for eBGP routes but it is also taken in to consideration while calculating the best path..
As you can see the best path for 33.33.33.33/32 on both routers is the eBGP learned route. This is because the eBGP route is more preferred than the iBGP route. But you can see the Local Preference is 100 for the iBGP route and as we know the Local Preference should be considered before the Path Type; shouldn't the iBGP route be chosen to be the best path?
This leads to a confusion as some people think eBGP route is more preferred over the iBGP route because eBGP has AD of 20 and iBGP has AD of 200 and in a case like this BGP best path selection process is ignored.
But this is not true..
Then what is happening here? Let's query the route attributes on the BGP rib for this route on R2,
To verify this theory I am changing the Local Preference of R1 advertising routes and see what happens..
R1(config)#router bgp 100
R1(config-router)#bgp default local-preference 500
Now the Local Preference is higher from iBGP route and it is chosen..
To understand the Local Preference route selection please go here.
Conclusion:-
Note that if you change the Local Preference from the eBGP neighbor, it will not make a change in R1 or R2 as Local Preference is advertised only to iBGP peers. But you can see that for all the routes learned (regardless of type of the neighbor), Local Preference is set to 100 by default even though it is not showing in the BGP table for eBGP routes but it is also taken in to consideration while calculating the best path..
No comments:
Post a Comment