Introduction
Border Gateway Protocol (BGP) is the routing protocol utilized for exchanging network reachability information between AS (Autonomous System) on the Internet. BGP facilitates the advertisement of its own network prefixes by each AS. This allows them to gain knowledge about prefixes of other ASes thereby ensuring end-to-end connectivity across the global network.
An essential aspect of BGP is its ability to allow each AS to apply its customized policies and preferences when it comes to routing traffic in and out of its network. These policies and preferences are conveyed through BGP attributes. These can be defined as the pieces of information attached to each prefix advertisement.
BGP attributes play a major role in influencing path selection, managing routing information distribution, and providing information regarding the network topology. You can learn more about BGP in our BGP OSPF Training. In this blog, we will explain the BGP attribute types, their classification along their use.
Before getting into more details, let’s first understand what are attributes in BGP.
What are BGP Attributes?
BGP attributes refer to the components that a BGP router attaches while describing various prefixes included in its BGP update messages. A prefix represents a network address along with its subnet mask, such as 192.168.1.0/24. In this context, a BGP update message denotes a communication sent by a BGP router to its peers (other BGP routers) for the purpose of advertising or withdrawing prefixes from their knowledge base. For instance, a BGB router might send an update message informing its peers that it can reach network 1.0.0.0/24 via a designated pathway.
BGP attributes provide information about the characteristics and preferences of each path, including its origin, length, weight, local preference, and more. BGP routers utilize these attributes to apply policies and preferences when determining the best path for each destination. For instance, a BGP router might prioritize a path with a higher weight or a lower AS path length compared to another path.
Categories of BGP Attributes
BGP attributes are classified into four categories:
- Well-known mandatory
- Well-known discretionary
- Optional transitive
- Optional non-transitive
Let’s now understand the four BGP attribute types in detail.

1. Well-Known Mandatory BGP Attributes
These attributes are crucial and must be included in every route advertisement. They are universally recognized by all BGP speakers. These attributes play a major role in ensuring BGP functions correctly. Apart from this, intermediate BGP speakers can’t remove or modify them. Below, we have discussed different types of well-known mandatory attributes.
AS-PATH
The AS-Path attribute comprises a list of numbers that the prefix has traversed before reaching the local router. Let’s take a case where a prefix has traversed AS 100, AS 200, and AS 300 before it reaches the router. Let’s say, for instance, that a prefix has traversed AS 100, AS 200, and AS 300 before it reaches the router. In this case, the AS Path attribute will be represented as 100 200 300. The purpose of the AS Path attribute is to avoid routing loops and choose the shortest path in order to reach the destination. A shorter AS-Path signifies a path that’s more favored or preferred path.
NEXT-HOP
The next hop attribute refers to the IP address of the router that serves as the step in reaching a destination prefix. For example, if a local router receives information about a prefix like 1.0.0.0/24 from its neighboring router at 192.168.1.1, then the next hop attribute will be set as 192.168.1.1. This attribute helps determine which interface should be used for forwarding packets towards the intended destination.
Origin
The origin attribute indicates how a particular prefix originated in the BGP (Border Gateway Protocol) system and has three values: IGP, EGP, or Incomplete.
- i (IGP): IGP signifies that the prefix originated from a gateway protocol (such as RIP, OSPF, or EIGRP).
- e (EGP): EGP indicates that it originated from a gateway protocol (like BGP itself).
- Incomplete: Incomplete means that the origin of the prefix is unknown or unspecified.
When choosing between paths, a path with an IGP origin is preferred over one with an EGP origin, which in turn is preferred over one with an Incomplete origin.
2. Well-Known Discretionary BGP Attributes
Well-known discretionary attributes are attributes that every BGP speaker must recognize but may or may not be present in a route advertisement. They are not mandatory for BGP to function correctly but can impact the process of route selection.
Below, we have discussed different types of well-known discretionary attributes.
Local Preference
This attribute indicates the preference for a route within an AS. A higher value simply suggests a more preferred path. It is used to influence outbound traffic from an AS to destinations. For instance, if an AS has two exit points to reach network 1.0.0.0/24, it can assign a local preference to one of them, making it the preferred exit point.
Atomic aggregate
This feature shows whether a prefix has been combined by a BGP router or not. Aggregation is the process of merging prefixes into one with a subnet mask, such as combining 192.168.1.0/24 and 192.168.2.0/24 into 192.168.0./23. Aggregation also assists in reducing the size of the routing table and improves scalability, but it may also lead to some loss of information about the original prefixes, such as their AS paths or next hops.
Now, let’s discuss the other classification of BGP attributes, i.e., Optional attributes.
3. Optional Transitive BGP Attributes
Optional transitive attributes may not be universally supported by all BGP implementations. Noncompliant BGP routers forward them unchanged when sending updates to peers, without any modification or removal. The word transitive simply means that the attribute can be passed from one AS to another without the use of any further modifications or removal.
Community
This attribute contains one or more values that identify a group of routes sharing common properties or policies. This also assists in making routing policy configuration and management easier by applying actions to a set of routes based on their community values. Let’s understand with the help of an example. A community value of 7474:100 means that the prefix belongs to AS 7474 and has a local preference of 100. Further, these attributes can be used to filter, modify, or accept prefixes totally based on their values.
Aggregator
This attribute is used to indicate the AS number and IP address of the router that performed route aggregation. This attribute contains the AS number and IP address of the router that created an aggregate route by summarizing multiple more specific routes. It is used to provide information about the originator of an aggregate route, which can be useful for troubleshooting or accountability purposes.
4. Optional Non-Transitive BGP Attributes
Optional non-transitive attributes are attributes that may or may not be recognized by every BGP speaker, but they must not be propagated beyond the next-hop router if they are not recognized. They are used to convey additional information about a route that is relevant only for the next-hop router and not for other BGP speakers. The optional non-transitive attribute is:
Multi-exit-discriminator (MED)
This attribute indicates the relative preference for a route among multiple routes from the same AS to a neighboring AS. It is used to influence the inbound traffic from a neighboring AS by indicating which entry point is preferred.
Originator_ID
This attribute is used in BGP Route Reflector environments to prevent routing loops. It contains the ID of the route originator.
Cluster
It is also used in Route Reflector configurations, the CLUSTER_LIST helps prevent routing loops by identifying the route’s path through the reflectors.
These are the various BGP Attributes.
The BGP Decision-Making Process
When BGP router receives multiple paths to the same destination, it enables a decision-making process to select the best route. A hierarchical process is followed where certain attributes are looked at first and if the routes are busy, then moved down to the next attribute.
Here is a simple versions of the process:
- Highest Local Preference (LOCAL_PREF): The path with the highest LOCAL-PREF is preffered.
- Shortest AS_PATH: The path with the fewest AS hops is preferred.
- Lowest Origin Type: IGP is preferred over EGP, and EGP is preferred over INCOMPLETE.
- Lowest MULTI_EXIT_DISC (MED): If multiple routes are learned from the same neighboring AS, the one with the lowest MED is preferred.
- eBGP over iBGP: External BGP routes are preferred over internal BGP routes.
- Lowest IGP Metric: The path with the lowest IGP cost to the NEXT_HOP is preferred.
- Oldest Path: If the routes are still tied, the path that has been in the routing table the longest is preferred.
- Lowest BGP Router ID: Finally, if all else is tied, the route with the lowest BGP router ID is preferred.
Why BGP Attributes Matter?
BGP Attributes allow network administrators to adjust the way their network handles traffic. It enables them to control which routes to prefer, prevent routing loops, better network performance, and optimize traffic flow by adjusting attributes like LOCAL_PREF, MED, etc.
BGP Attributes also help with the security of networks by filtering out the routes with suspicious activities. Furthermore, they give flexibility for internet service providers (ISPs) and large organisations to manage complicated routing setups, ensuring data arrives at its destination efficiently and reliably.
Use cases of BGP Attributes
Some of the common use cases of BGP Attributes are:
- Traffic Engineering: BGP Attributes can be adjusted to change traffic paths and balance the load across various paths.
- Route Filtering: BGP Attributes let network administrators apply routing policies and control which routes are advertised.
- Redundancy and Failover: AS_PATH length and LOCAL_PREF are key attributes to consider while developing a robust network. In the event of a link breakdown, BGP attributes ensure that traffic is swiftly rerouted through backup paths.
Frequently Asked Questions
Q1. What is the BGP weight attribute?
The BGP weight attribute is specifically for the Cisco parameter that is mainly used to determine the best path for outbound traffic. More importantly, it is local to the router and is not advertised to peers.
Q2. What is the correct BGP path attribute list?
The BGP path attribute list follows:
- Weight
- Local preference
- Locally originated
- AS path length
- Origin type
- MED
- EBGP over IBGP
- Router ID
Q3. What is BGP features?
Some of the basic features of BGP include:
- Next-hop support
- Configurations for inter-autonomous system
- Path information
- Conserving network bandwidth
- Policy support
- Support Classless Inter-Domain Routing
Q4. What are path attributes?
Path attributes are defined as the properties of network paths that directly or indirectly affect the routing decision. It includes metrics, preferences, and many others.
Conclusion
BGP attributes are an important part of BGP routing, as they provide information about the characteristics and preferences of a route. Attributes in BGP can be classified into four categories based on their presence, recognition, and propagation. BGP speakers can also modify BGP attributes to influence the routing decisions of other BGP speakers. Understanding how BGP attributes work and how they affect the route selection process is essential for anyone who wants to master BGP routing.