BGP Attributes | BGP Part-3
Summary Insights:
- In Routing the best path selection out of multiple paths is very important. Every routing protocol has different criteria or algorithm to select best path. In IGP OSPF Cost is the main metric to calculate best path. But in BGP best path selection is depend on multiple parameters called BGP attributes.
- As BGP is connecting the devices all over the internet is very complex to control incoming & outgoing traffic b/w different Autonomous systems, it can be handling through multiple attributes.
Interview Questions & Answers of BGP Attributes:
- What is BGP Attribute & how many main categories of attributes?
- Which attributes are in optional transitive?
- Which route will be preferred, Non-reflected & reflected by RR?
- Originator ID is part of which categories attributes?
- What is difference b/w well-known & optional?
- What is MED?
- What is Atomic aggregate attribute?
- What in inbound & outbound BGP attributes?
- Why using MED when local preference attribute available?
- Size of local preference value in bits?
- What is difference b/w local preference & weight?
- Originate Vs Origin attributes?
- Why using community attributes?
- What are the well know community attributes?

There are below four main Categories of BGP Attributes :
- Well-known Mandatory
- Well-known Discretionary
- Optional Transitive
- Optional Non-transitive
Well-known Mandatory:
The attributes which must be identified & carrying in Update message by the BGP router.AS Path, Origin & next-hop belong to well-known mandatory attributes. The detailed explanation of each attributes with example will be in later section.
Well-known Discretionary:
The attributes which must be identified by BGP Device but it’s optional in update message. Local preference, atomic aggregate is the example of well-known discretionary attribute.
Optional Transitive:
When device identify/support the attributes or not but accept & advertise to the peer. Community & aggregator are the example of this type of attributes.
Optional Non-Transitive:
If device not identify/support attributes then it will ignore & not advertise to the peer. Multi-exit discriminator (MED), Originator ID, Cluster List is the example of Optional non transitive attribute.
Summary table of BGP Attributes:

Now let me explain attributes in details, below are the BGP attributes
- Weight/pref value.
- Local Preference.
- Originate (local).
- AS Path.
- Origin.
- MED.
- eBGP over iBGP.
- Oldest path.
- Shortest IGP Cost to next hop.
- Non reflected routes prefer with shortest Cluster Length.
- Router ID
- Neighbor IP Address.
Note:
Some attributes will not participate during path selection rules but they are very important in BGP route advertisement that I will explain in separate section.
- Atomic aggregate & Aggregator.
- Community Attribute.
- MP_REACH_NLRI & MP_UNREACH_NLRI
- BGP Site of Origin (Soo).
Incoming(Inbound) & Outgoing(Outbound) BGP Attributes:
Next let me explain BGP attribute in one other perspective that is incoming & outgoing traffic attributes.
Inbound BGP Attributes:
Attributes which influence or handle incoming/inbound traffic to the Autonomous system called incoming attributes. AS Path & MED are Inbound BGP attributes that I will explain with topology example.
Outbound BGP Attributes:
Attributes which influence or handle outbound traffic from the autonomous system called Outbound BGP attributes. Local preference & weight/pref value are the outbound attributes.
Let’s start BGP Attributes one by one
Weight or preferred value:
Weight is cisco property working on cisco devices only. In Huawei devices it’s called preferred value.This attribute is locally to the router & not advertise to any other device & not in update message.If one local router learning routes from BGP peer then this local router can assign weight value to that routes & take decision on base of weight when sending traffic outside that’s why called it outbound BGP Attribute.
Weight default value is 0 & can be configured other value, The highest value will be preferred.
Local Preference:
This attributes is locally to the autonomous system means it will advertised to IBGP peer.It will decide the path when traffic leaving/outgoing from the autonomous system.thats why called outbound attribute. Its 32 bits value, Default value is 100 but can be changed, highest valued will be preferred.
Weight Versus Local Prefrence:
- Both are outbound attributes decide the best path when traffic is leaving the AS.
- Weight is locally to router & local preference is locally to autonomous system (AS).
- Local preference will advertise to IBGP peer but weight will not advertised to IBGP & EBGP peer.
Originate:
The locally originate will be preferred means that if one route received in BGP update from any peer & same is advertised by local router with Network command then local router decision will be preferred.
Locally originated routes will show with next-hop 0.0.0.0.
AS Path:
It is the number of autonomous systems (AS, s) through which the route traversed. Shortest & less number of AS, s path will be preferred. Due to prepending of AS,s we can influence the inbound traffic that’s why called it inbound attribute. When it passes through different Autonomous systems the AS number will added in left side of list. For example the route first passes through AS#100 then 200 & last 300 then AS Path list will be [300 200 100]. No AS will be added when routes are advertised to IBGP Peer. Local AS will be attached when advertising to EBGP Peer.
Origin:
Well-known mandatory attribute, its indicate that how the route is detected in BGP. There are three method that how routes are originated into the BGP.
- IGP (i).
- EGP (e).
- Incomplete (?)
IGP:
Any route in our internal IGP domain should available through by IGP, static or locally configured on device like loopback IP Address. To inject these routes to BGP domain or table then must advertised in BGP through “Network” command.
IGP have high priority then EGP & Incomplete.
EGP:
Exterior gateway protocol, this is old version of BGP, if routes learn from this then it will show as EGP in BGP table. Now a day this protocol is not using in real scenario.
Second highest priority after IGP but more prefer than Incomplete.
Incomplete:
When route is redistribute/import from other IGP protocol like OSPF, ISIS, Static route. Incomplete not means that it’s unreachable but it means this route is redistributed/imported to BGP.
Less priority than IGP & EGP.
Difference b/w Originate & Origin OR Originate Vs Origin attribute:
Originate means that the locally originate route with Network command will preferred. Now you will think that in origin is also Network command IGP. But the main difference is that in Origin attribute route can advertise through Network command on any routers in AS & when same route through redistribution incomplete then IGP (Network command) will prefer. But originate only for that locally router.
Multi-exit Discriminator(MED):
The optional non-transitive attribute used b/w Autonomous system for handling the incoming traffic to the AS.if received MED from peer AS then it will not advertised to any other AS. It’s used in scenario when one router connected to two different routers of other AS then which link will used to receive the traffic its depend on lowest MED value. It’s used in scenario when one router connected to two different routers of other AS then which link will used to receive the traffic its depend on lowest MED value.
Why using MED if we have local-preference & other attributes:
Due to some restriction on neighboring AS to configure Local-preference then in this case will configure MED attributes. When local preference configured on neighbor AS then no need to configure MED on other AS for inbound traffic.
eBGP Over iBGP & oldest Path:
Exterior Border gateway protocol (eBGP) is running b/w Autonomous systems.iBGP is running within AS. When same route is learned from EBGP & IBGP then EBGP will be preferred.
If same route learned from multiple EBGP side then the oldest & stable route will be preferred.
Shortest IGP cost to BGP next Hop:
The shortest IGP cost to the BGP next hop will be preferred. When route learned through IBGP then during recursive routing table lookup to find the BGP next hop is through IGP protocol ,smallest IGP cost will be decided.
Non reflected routes prefer with shortest Cluster Length:
Route Reflector (RR) & Cluster List topic I will explain in upcoming posts. But keep in mind that the non-reflected routes will be preferred over the reflected routes with lowest shortest cluster List attribute.
Router ID:
On BGP Router ID can be configured atomically or manually. During BGP best path selection the lowest neighbor router ID will be preferred.
Neighbor IP Address:
When all above attributes are same it means that learning routes from same router but on different peer links. Then the lowest Neighbor IP Address link will be preferred.
BGP Path selection rule:

Along with learning about BGP attributes such as BGP well-known attributes and optional attributes , it is equally important to understand BGP packet types and the BGP finite state machine (BGP states)
