Wired Intelligent Edge (Campus Switching and Routing)

 View Only
last person joined: one year ago 

Bring performance and reliability to your network with the HPE Aruba Networking Core, Aggregation, and Access layer switches. Discuss the latest features and functionality of HPE Aruba Networking switching devices, and find ways to improve security across your network.

How to alter BGP path selection for a route learnt over both eBGP and iBGP 

Oct 31, 2018 10:59 PM

Requirement:

How to alter the default BGP path selection process when the same route is learnt over eBGP and iBGP at the same time.



Solution:

The BGP path selection depends on the following criteria:

  • Prefer the route with the lowest Administrative Distance.

  • Prefer the route with the larger weight.

  • Prefer the route with the highest LOCAL_PREF value.

  • Prefer the path that was locally originated via a network or through redistribution from an IGP.

  • Prefer the route with the shortest path, excluding confederation segments.

  • Prefer the route with the “best” ORIGIN. IGP is better than EGP, which is better than Incomplete.

  • If bgp always-compare-med is not configured, prefer any routes that do not have an inferior MED. If bgp always-compare-med has been configured, prefer the route with the lowest MED.

  • Prefer the route with the lowest IGP cost to the BGP next hop. IGP cost is determined by comparing the preference, then the weight, then the metric, and finally the metric2 of the two resolving routes.

  • If “ip load-sharing” is enabled, BGP inserts up to n most recently received paths in the IP routing table. This allows eBGP multipath load sharing. The maximum value of n is currently 4. The default value of n, when “ip load-sharing” is disabled, is 1. The oldest received path is marked as the best path in the output of show ip bgp prefix/len.

  • Prefer routes received from external peers.

  • If bgp tie-break-on-age has been specified, prefer the older route.

  • If bgp bestpath compare-router-id has been specified, prefer the route learned with the lowest router ID. The router ID is taken from the Open message of the peering session over which the route was received, unless bgp bestpath compare-originator-id has been specified, and the route was received with an ORIGIN_ID. In the latter case, the ORIGIN_ID is used instead of the router ID from the Open message.

  • If bgp bestpath compare-cluster-list-length has been specified, prefer the route with the lowest CLUSTER_LIST length.

  • Prefer the route with the lowest neighbor address.

 

 

The topmost criteria for BGP path selection is Administrative distance. So if a route is learnt over eBGP and iBGP at the same time, the routes learnt over eBGP take preference and make their way into the routing table, since it has a lower AD value of 20 as compared to the AD value of 200 for iBGP.

It may be required for your setup that the route learnt over iBGP should make it's way to the routing table instead of the same route learnt over eBGP.

So as a solution, on the particular switch we can change the AD value of eBGP and iBGP to the exact same value and have the next criterias come into play like the WEIGHT, LP, AS path and so on..

 



Configuration:

We have setup the following lab :

 

SW1 (AS100) and SW2(AS101) are eBGP neighbors,

SW2(AS101) and SW3(AS102) are eBGP neighbors,

SW3(AS102) and SW4(AS100) are eBGP neighbors,

SW3(AS100) and SW1(AS100) are iBGP neighbors

 

On Switch, SW3, we have advertised two loopback networks into BGP 

77.77.77.1/32 and 111.11.11.1/32 

 

In order for route selection to fallback on LP which is 100 for iBGP routes we use the following command,

SW1(config)#router bgp 100 distance bgp 20 20 

 

Note1: We can alter the Weight for the iBGP routes, make it greater than the default (0) value for the incoming traffic to make the selection of the ougoing routes.

             However here we have taken an example of minimum configuration and leveraged the LP value (100) default for the iBGP routes.

 

NOTE2 : Internal BGP (IBGP) sessions use a metric called the local preference, which is carried in IBGP update packets in the path attribute LOCAL_PREF. When an autonomous system (AS) has multiple routes to another AS, the local preference indicates the degree of preference for one BGP route over the other BGP routes. The BGP route with the highest local preference value is preferred.

The LOCAL_PREF path attribute is always advertised to IBGP peers and to neighboring confederations. It is never advertised to external BGP (EBGP) peers. The default behavior is to not modify the LOCAL_PREF path attribute if it is present.

The default LOCAL_PREF path attribute value of 100 applies at export time only, when the routes are exported from the routing table into BGP.

If a BGP route is received without a LOCAL_PREF attribute, the route is stored in the routing table and advertised by BGP as if it were received with a LOCAL_PREF value of 100. A non-BGP route that is advertised by BGP is advertised with a LOCAL_PREF value of 100 by default.



Verification

Following is the output from SW1 for the BGP table and the routing table.

 

 

 

As Could be seen from above that routes learnt over eBGP take preference and make their way to the routing table because of a lower AD value of 20, although they have a lower LP value and AS path length.

So in order to for the iBGP routes to make it to the routing table, we configure both eBGP and iBGP AD value to 20 and as a consequence based on a higher LP value, iBGP routes will make their way into the RT. 

 

SW1(config)#router bgp 100 distance bgp 20 20 

 

Statistics
0 Favorited
7 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.