BGP Attributes and Path Selection

How BGP selects path if I advertised routes from same AS numbers where BGP detects two similar paths with nearly the same local preference, and weight as well?


Hello Vijay

BGP will always follow the path selection process based on a series of attributes that it compares. These attributes are compared in a specific order and are used as tie-breakers. If the attribute is the same for two or more paths, then the next attribute is compared. If all else fails, the very last tiebreaker is the neighbor IP address, where the path with the lowest neighbor IP address is preferred. This will always be a tie-breaker because the IP addresses of neighbors cannot be the same.

The first attribute that is examined is weight. If it is the same, then the local preference will be examined. If the local preference is “nearly the same” then it is not the same, so the highest local preference will be chosen.

Take a look at this lesson to see all of the attributes and the order in which they are examined.

I hope this has been helpful!


How do you manipulate the inbound and outbound flow of traffic in BGP?
If we use weight to manipulate the outbound flow of traffic then why are we setting this as ‘in’ direction for the neighbor statement and similarly for the inbound flow of traffic we set it in ‘out’ direction.
Can AS-Path be used to manipulate both inbound and outbound?

Hello Kishore

Take a look at this post, I believe it will clarify the issues with “in” and “out” that you mention here:

But how else do we manipulate incoming and outgoing traffic? You have ultimate control over your outbound traffic flow using BGP. However, you do not have ultimate control over your incoming traffic. You can influence it in various ways, but you can’t ultimately control it. More info about this can be found at the following post:

If you have any further questions, feel free to ask!

I hope this has been helpful!


Once the Administrative distance would be same and also the prefix length would be same then we will compare the path attributes between them …Right ?


I want to understand the best path selection criteria in case of iBGP if we are receiving the the same route from multiple paths.

Hello Kirshan

In all cases, if you receive a particular prefix from multiple sources, then you still go through the BGP attributes in order, so that you can determine which path is best, and thus, which path to put in the BGP table.

I hope this has been helpful!


I have a question.
Does BGP not do load balance between different links ? Does BGP always choose only one path? Thanks.

Hello Raphael

By default, BGP will select only a single path for a prefix. You can see this from the very last attribute that is examined. If all other attributes are the same, at the very end, a BGP router will prefer the path with the lowest neighbor IP address. This is the last tiebreaker, and the neighbor IP addresses will never be the same, so one will always win out over the other.

If you want BGP to perform load balancing, you will have to configure it to do so. This can be done using a feature called Multipath load sharing, and you can learn about it here:

I hope this has been helpful!


Hello Narad

If you have routing information to a particular destination that is coming from several routing sources such as different routing protocols, then yes, the first thing that would be examined is the administrative distance.

Secondly, for all routing information you are receiving about a particular destination, the prefix length must be the same, otherwise, you are looking at two different destinations. In such a case, each destination would be examined independantly.

I hope this has been helpful!


We are implementing a Dark Fiber Solution for all of our 4 sites to provide high bandwidth and private WAN Link. The 4 sites will have Ring Connection to each other which will be provided by the Service Provider. We are implementing BGP for the first time in the network.
The plan is to have the 4 sites in the same ASN number and I would run iBGP across the sites to create a full mesh connection.i would create a Layer 3 Interface on each Cisco 9300 switch in the same subnet.
My concern is routing to the ISP. if I want 2 of my sites to be Primary and Secondary Hub for routing to the ISP.I dont want to load balance Routes due asymmetric routing scenario.

What would be considered as the Best practice for routing to ISP in this case?

Hello Temitope

First of all, in such a scenario, I would either use an IGP between all sites (for faster convergence) or make each of the four sites a different AS and run eBGP between the sites, and an IGP within each site. Remember that typically, within an AS, it is the IGP that is used for routing, while iBGP is typically used to gather information about prefixes internal to an AS. These prefixes are then shared via eBGP between ASes.

Now having said all of that, it is possible to use iBGP within an AS to route traffic, but because it is generally slow to converge, it is not recommended. Now you may have a specific reason behind your particular design, and that’s fine.

If we were to keep your topology and design, how can you use iBGP to make sure that load balancing does not occur so that you avoid asymmetric routing? Well, if you use iBGP then you have nothing to worry about. BGP by default does not perform load balancing. It will always choose a single path to reach the destination. Unlike OSPF and EIGRP which both do equal cost load balancing if the metric for two or more paths is exactly the same.

So if you configure your BGP attributes so that the primary ISP is chosen as the best path, you have nothing to worry about when it comes to load balancing.

I hope this has been helpful!


Hi Rene,

What is AFI and SAFI?


Hello Manami

Address Family Indicator (AFI) and Subsequent Address Family Indicator (SAFI) are fields within Multi-Protocol BGP (MP-BGP) extensions. The information in these fields is sent as part of the neighbor capability exchange during the process of becoming BGP peers. The information in these fields is used to tell the remote peer what address family (IPv4, IPv6, VPNv4, VPNv6 etc.) and what specific sub-address family (multicast or unicast) the local BGP router will be transporting routes for.

I hope this has been helpful!


Hello, everyone.

With eBGP peerings, is the “Prefer the oldest route/Route that was learned earlier” considered the final one? Since this seems like the final tiebreaker that will always pick one path over another without moving to the rest (lowest RID/neighbor iP).

So does this mean that the lowest RID/neighbor IP tiebreakers are limited to iBGP peerings only?

Kind regards,

Hello David

The “Oldest Path” attribute written out in full is the one that says: “When both paths are external, prefer the path that was received first (the oldest one).”

So this attribute is only valid for routes external to the local AS. Now your question comes down to this: Is it possible for this to be a tie? Well, this attribute is designed in such a way that it’s extremely unlikely to result in a tie. This is because it is based on the timing of when the route was received.

In a real-world scenario, it’s practically impossible for a router to receive two routes from two different peers at the exact same microsecond. Thus, this tiebreaker will almost always be able to determine a preference between routes, unless perhaps in the highly unlikely event of some form of synchronization or a bug.

So to answer your question, it is not impossible, but it is extremely unlikely that this tie breaker will be unable to resolve the issue. So in virtually all cases, for external paths, this will be the last attribute to be checked.

Well, the attributes are used to choose the best “path” not the best “peering”. So it doesn’t really matter what peerings the particular router has, but what is taken into account is if the path is external to the local AS. An iBGP router that has no eBGP peerings can still receive two paths to a particular external prefix, so the attribute is still examined. Does that make sense?

I hope this has been helpful!



Hello Laz!

Allow me to elaborate on this

So does this mean that the lowest RID/neighbor IP tiebreakers are limited to iBGP peerings only?

If the received route contains an external prefix but was advetised to us by an iBGP neighbor, doesn’t that automatically make it an iBGP route? So the “Prefer oldest path for eBGP” tiebreaker cannot be used there.

By the way, an excellent explanation about everything I’ve asked for, thank you :slight_smile:


Hello David

An eBGP route is defined as a route received directly from an eBGP neighbor (a neighbor in a different AS). When the route is first received via eBGP, it’s marked as an external route.

If that route is then propagated within the same AS using iBGP (from one router in the AS to another), it retains its characteristics as an eBGP-learned route, including its original AS Path and other attributes. However, the mechanism of its propagation within the AS is through iBGP. In other words, the “source” or “origin” of the route in terms of AS traversal is still eBGP because it is external, but the immediate source of propagation within the AS is an iBGP peer.

What does that mean for our attribute? When we refer to the “oldest path for eBGP routes” in the BGP decision-making process, we’re talking about routes that originated from an eBGP neighbor, regardless of whether they were subsequently propagated within the AS using iBGP.

So if a BGP router learns about a route to a network external to its local AS, regardless of whether it learns about that route via iBGP or eBGP, the particular attribute applies, simply because the path is to an external network.

Note that the text of the attribute is “when both paths are external”. It doesn’t stipulate how you learned those paths (iBGP or eBGP), but simply that the paths are external.

No, but it does mean that the lowest RID/neighbor IP tiebreakers are limited to multiple routes to internal paths.

I hope this has been helpful!


Hello everyone,
I’m getting confused over path selection, say my router gets 3 routes for identical destinations : ospf with default parameters; ebgp with default parameters; ibgp with local preference set to 200. How is the decision made and which route will be selected?


Hello Betul

This is an excellent question, and its answer will help to clarify the process by which routes are installed in the routing table.

When a router learns about paths to particular destinations from multiple sources (OSPF, BGP, static routes etc), before the actual BGP path selection process is even considered, the first thing that happens is it chooses which source of the routing information to use. This is determined using the Administrative Distance (AD).

If BGP (either iBGP or eBGP) becomes the source of choice using the AD, only then will the BGP best path algorithm take place. For more information about this process, take a look at this NetworkLessons note about how the routing table is populated.

I hope this has been helpful!