04-29-2020 12:25 AM
Suppose we have 3 routers. R1 & R2 are in the same AS & the other is in a different one. Router that count as eBGP has lower metric than the other that is iBGP. Which one will be chosen as the best next hop?
Thanks
Solved! Go to Solution.
04-29-2020 07:48 AM - edited 04-29-2020 07:50 AM
Hello miracle_david@yahoo.com ,
the command bgp always-compare-med is needed in the case that you want to make comparable two BGP advertisements that have two different AS paths attributes that are of the same length (number of ASN in the path) but they differ in the peer AS (the leftmost AS, that is the BGP AS that passed the advertisemnt to the local router /AS).
The MED attribute is not the first criteria in the BGP best path selection.
by default MED values coming from different ASes are considered not comparable as each ISP is free to set it or even not setting it ( by default a missing MED is advertised as MED 0 that would be the best possible value).
In real world when a multihomed customer AS with eBGP relationships with ISP A and ISP B the negotiation can lead to a coordinate action in setting the MED and so in this case using the command bgp always-compare-med becomes appropriate because all the involved actors (the customer, and its upstream providers iSPA and ISPB) have agreed on this.
In all other cases using that command is not recommended.
Note: the MED attribute can be set only by directly connected eBGP ASes, it is not a global parameter it is reset to zero when sending to another AS. It comes from a peer AS.
There are other parameters that can be tuned like local preference.
Finally there is a correlated command to make the value of a missing MED not zero but the highest value possible for this parameter. This is recommended when multihoming and using MED as the criteria to choice the upstream provider.
Hope to help
Giuseppe
04-29-2020 12:37 AM
Administrative Distance of eBGP is 20 vs iBGP is 200
04-29-2020 01:27 AM
Hello miracle_david@yahoo.com ,
even in case of a tie an eBGP path is preferred over an iBGP path because it is considered first hand information.
The AS path attribute is not changed in iBGP until a router needs to advertise to a router in another BGP AS over an eBGP session.
The BGP best path choice is performed in the BGP table aka BGP RIB and the admin distance is not considered in this context even if as noted by @omz it will lead to the same choice.
AD is used by the IP routing table daemon.
BGP performs the best path selection before and presents its best path choice to the IP routing table daemon.
Hope to help
Giuseppe
04-29-2020 05:40 AM
04-29-2020 07:48 AM - edited 04-29-2020 07:50 AM
Hello miracle_david@yahoo.com ,
the command bgp always-compare-med is needed in the case that you want to make comparable two BGP advertisements that have two different AS paths attributes that are of the same length (number of ASN in the path) but they differ in the peer AS (the leftmost AS, that is the BGP AS that passed the advertisemnt to the local router /AS).
The MED attribute is not the first criteria in the BGP best path selection.
by default MED values coming from different ASes are considered not comparable as each ISP is free to set it or even not setting it ( by default a missing MED is advertised as MED 0 that would be the best possible value).
In real world when a multihomed customer AS with eBGP relationships with ISP A and ISP B the negotiation can lead to a coordinate action in setting the MED and so in this case using the command bgp always-compare-med becomes appropriate because all the involved actors (the customer, and its upstream providers iSPA and ISPB) have agreed on this.
In all other cases using that command is not recommended.
Note: the MED attribute can be set only by directly connected eBGP ASes, it is not a global parameter it is reset to zero when sending to another AS. It comes from a peer AS.
There are other parameters that can be tuned like local preference.
Finally there is a correlated command to make the value of a missing MED not zero but the highest value possible for this parameter. This is recommended when multihoming and using MED as the criteria to choice the upstream provider.
Hope to help
Giuseppe
04-29-2020 03:00 AM
The eBGP is always Preferred over iBGP , as per the attribute.
AD is always used to compare the best path for a particular prefix before making it as best and installing it in the routing table.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide