Network Kings

What is a BGP Attributes? – Explained

BGP Attributes

BGP router attaches BGP Attributes to various prefixes contained in its BGP update messages to define them. Except for update messages that contain just withdrawn routes, every update message has a different set of BGP properties.  

BGP attributes get classified into different types that define how routes will use and propagate a specific attribute to their neighbors. The types of attributes are discussed in detail in our blog post. 

What are the kinds of BGP Attributes?

Well-known BGP attribute types are as follows- 

  • Well-known Mandatory 

The well-known mandatory attribute must get acknowledged by all BGP implementations that exist in BGP update messages.  

  • Well-known Discretionary 

The well-known discretionary attribute must get acknowledged by all BGP implementations, but it is not crucial to advertise it in BGP updates to all BGP neighbors. 

What are the other lesser-known types of BGP Attributes?

The Optional BGP attribute types are as follows-  

  • Optional Transitive 

Transitive attribute between ASs. A BGP router that is not supporting this attribute can still receive routes with this attribute and advertise them to other peers, i.e., the community.  

  • Optional Non-transitive 

If a BGP router does not support this attribute, It will not advertise a router with this attribute. 








Well-known Mandatory 






Well-known Discretionary 






Optional transitive 






Optional non-transitive 





What are the types of Well-known Mandatory Attributes?

The kinds of well-known mandatory attributes are as follows- 

  • ORIGIN Attribute 

It is used to recognize the originator of the route. It identifies the originating source of the route. There are three possibilities: –   

  1. I (IGP): – Originated from a gateway protocol on an internal network, such as OSPF. Typically, this means the route was added to BGP using the network command within the BGP procedure.  
  2. e (EGP): – Originated from an external gateway protocol.  
  3. Incomplete: – Unknown origin. This usually indicates the route was redistributed into BGP from either connected, static, or IGP routes. 
  • AS_PATH Attribute 

This attribute identifies the list or path of traversed AS to reach a particular destination. The AS path attribute is applied to outbound routes, dictating the best inbound path. AS-Path attributes comprise- 

  1. Prepend or filter: – To prepend to the existing AS-path results in a longer AS-path, which makes the route less desirable for inbound traffic. 
  • NEXT HOP Attribute 

It is not surprising that a BGP prefix has a Next Hop attribute. After all, a router has to know where to route traffic for that prefix. This need is satisfied by the Next Hop attribute. It identifies the next hop’s IP address to reach a particular destination.  

It involves three types of values:  

  1. When advertising a self-originated route to a BGP peer, a BGP speaker sets the NEXT_HOP for the route to the address of its sending interface. 
  2. When a route is received and sent to an eBGP peer, a BGP speaker sets the NEXT_HOP for the route to the address of the sending interface. 
  3. When a route is received from an eBGP peer and sent to an iBGP peer, a BGP speaker does not modify the NEXT HOP attribute.

What are the types of Well-known Discretionary Attributes?

The types of well-known discretionary attributes are as follows- 

  • Local Preference 

Local preference provides a preference to determine the best path for outbound traffic. This attribute is applied to inbound external routes, which tells the best outbound path. Local preference is shared with iBGP peers when sending updates. It informs iBGP routers how to exit the AS if multiple paths exist. 

What are the types of Optional Transitive Attributes?

The types of optional transitive attributes are as follows- 

  • Aggregator 

This attribute identifies the BGP router that performed an address aggregation.  

  • Community 

This attribute uses the tag routes that share common characteristics in communities. 

What are the types of Optional Non-transitive Attributes?

The types of optional non-transitive attributes are as follows- 

  • Multi-exit-Discriminator (MED) 

This attribute provides a preference for EB peers to a specific inbound router. 

What is BGP's Best Path Determination?

BGP considers the first received path the best path, but as other paths are received for the same prefix, the newer path is taken into consideration and is compared to the older paths. Comparison is done based on the BGP Attributes. Attributes are compared in the order listed below.  

NOTE: If there is a tie, we move to compare the next attribute until the best path is identified. 

How are the attributes compared?

The attributes get compared in the order given below-   

  • Weight 

The path configured with the highest weight is always preferred. Weight is assigned locally to the router and does not travel to the other routers i.e.; it is locally defined. It is used to influence the outbound traffic.  

  • Local Preference 

Local preference is the attribute that travels within an Autonomous System i.e., it is not local to the router and exchanged between IBGP routers. The path with the highest Local Preference is preferred. It is used to influence the outbound traffic. Local Preference has a default value equal to 100.  

  • Locally Originated 

A path originated by the local router is preferred.  

  • AS-Path 

The path with the shortest AS-Path length is preferred i.e. path with less number of different AS in between is preferred.  

  • Origin Code 

Indicates the origin of the route. It can have three possible values: IGP (Interior Gateway Protocol), EGP (Exterior Gateway Protocol), or Incomplete. The lowest origin code is preferred. The origin code value for IGP is lower than EGP while the value for EGP is lower than Incomplete.  

  • MED 

The path with the lowest MED value is preferred. It travels within an Autonomous system i.e., it is exchanged between the same AS  

  • BGP Route Type 

Is this an eBGP or iBGP route? eBGP path over the iBGP path is preferred.  

  • Age 

Which route is the oldest? The oldest received path is preferred.  

  • Router ID 

A path with the lowest neighbor Router ID is preferred.  

  • Peer IP address 

A path with the lowest neighbor IP Address is preferred. 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.