The Internet owes its existence in part to the operation of the Border Gateway Protocol or BGP. BGP is a routing protocol that uses a list of attributes to determine the best path to the intended destination.
It is these attributes that give BGP the characteristics necessary to perform its highly demanding routing obligations on a network as vast as the Internet.
In this article, we’ll examine these attributes in an effort to further understand the crucial role they play in enabling the Internet.
BGP – Short Review
IGPs such as EIGRP and OSPF use the concept of “cost” to evaluate paths to network destinations. These routing protocols assign a particular metric to each path, and they use this metric to determine the best next hop IP and exit interface and install it in the local routing table.
Unlike IGPs, BGP doesn’t use this concept of cost. BGP is what is known as a path vector routing protocol, and indeed, it is the only such protocol in operation today.
BGP determines the best path to a destination, and it defines that path via a list of Autonomous Systems (ASes) through which the packet must travel to reach its destination. The following is a BGP table from a real BGP router on the Internet.
BGP table version is 1344185304, local router ID is 18.104.22.168
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
*>i22.214.171.124/24 126.96.36.199 10 80 0 13335 i
* i188.8.131.52/24 184.108.40.206 70 0 6830 6453 4755 45528 45528 45528 45528 45528 i
*>i 220.127.116.11 70 0 6830 6453 4755 45528 45528 45528 45528 45528 i
*>i18.104.22.168/24 22.214.171.124 70 0 6830 6453 4755 45528 45528 45528 45528 45528 i
* i 126.96.36.199 70 0 6830 3356 55410 45528 45528 45528 45528 45528 i
* i188.8.131.52/24 184.108.40.206 70 0 6830 3356 55410 45528 45528 45528 45528 45528 i
*>i 220.127.116.11 70 0 6830 3356 55410 45528 45528 45528 45528 45528 i
You can see that the route to the network 18.104.22.168/24 is indicated under the Path column of the BGP table, which shows us that we must go through the following ASes: 6830 6453 4755 45528 45528 45528 45528 45528.
The local router is found within AS 6830, which is why it appears first in the AS path list. The BGP table tells us that we must go through seven more ASes to reach AS 45528 which contains the destination network. It also tells us the next hop IP of the BGP peer to which the packet should be sent, which is 22.214.171.124.
In actual fact, what BGP does is determine the route to the destination AS. That’s the AS within which the destination resides.
Once the packet reaches that AS, it is up to the internal routing mechanisms, typically performed by an IGP, to get the packet to the particular host in question.
Note: The BGP table displayed above comes from what is known as a BGP looking-glass server. These are servers that you can log into and observe the BGP tables on the Internet. This particular server is actually a Cisco router found in Switzerland. You can log in and test it out as well by Telnetting to routeserver.sunrise.ch, without a password. Using the show bgp command, you can display the device’s BGP table.
The role of BGP is essentially to determine the AS path for each individual destination and put it in the BGP table. So how does BGP determine the best AS path? It uses a list of attributes.
BGP attributes give us much more control over how routes are selected, and routing on the Internet needs that level of granularity.
Unlike within an enterprise network, the shortest path is not always the preferred path. Attributes give BGP a level of control that goes way beyond what a mere IGP would be able to handle.
The AS path is determined based on a series of attributes in a specific order. Each attribute is examined in this particular order, and if there are two or more paths that are equal, then the next attribute in order will be examined.
This process continues until there is only a single path that fulfils the configured attributes, which becomes the best path, and is added to the BGP table.
The following is the list of attributes used by BGP:
- Weight: This is a Cisco-specific attribute, and it is local to the router on which it is configured. Paths with a higher weight are preferred.
- Local Preference: This attribute indicates which path has preference to exit the AS. A path with a higher local preference is preferred.
- Locally Originated: If the local router originated the route, it’s preferred over other routes.
- AS-Path: This attribute holds a list of AS numbers that a route has traversed. A shorter AS-Path is preferred.
- Origin: This attribute indicates how BGP learned the path. Paths learned via IGPs are preferred over those learned via BGP, and BGP paths are preferred over incomplete paths.
- Multi-Exit Discriminator (MED): This attribute is used for BGP neighbors in the same AS. If the neighbor AS has multiple connections, the MED attribute is used to select the best path. A lower MED value is preferred.
- eBGP over iBGP: If one path is learned via external eBGP and another via internal iBGP, the eBGP path is preferred.
- Shortest IGP path to BGP next hop: The path with the shortest IGP path to the BGP next hop is preferred.
- Oldest path: If the paths are still equal, BGP will choose the oldest path, that is, the path that was learned first.
- Router ID: The path with the lowest router ID will be chosen.
- Neighbor Address: If paths are still equal after considering the router ID, the path with the lowest neighbor BGP identifier is preferred. This attribute will never be the same, so it is the ultimate tiebreaker.
Some Cisco documentation may indicate that there are actually 13 attributes involved in the BGP process. However, those two extra attributes mentioned (numbers 9 and 12 in the documentation) are only valid in situations where multiple paths are involved. This is only valid when BGP multipath is enabled.
It is true that it can be difficult to understand some of these attributes and how they play a role in determining the best path. It is not always readily perceivable why the attributes have been chosen and why they are in this particular order. However, over time, as you gain more experience using BGP, either by labbing up BGP topologies, or learning from production BGP networks, you will gain an appreciation for the elegance of this series of attributes.
The benefits of using Attributes
As we mentioned before, the use of attributes in BGP to determine the best path is beneficial because it gives a lot of control to network administrators over how routing takes place. The benefits are further broken down and analyzed below:
- BGP attributes provide a very high level of control over path selection. This is particularly useful in large and complex networks (such as the Internet) where simple cost or metric-based approaches may not provide the desired level of control.
- BGP attributes allow for policy-based routing. Network administrators can manipulate BGP attributes to implement complex routing policies. This is important in the context of the Internet where routing decisions often need to take into account commercial, financial, or political factors, not just technical ones.
- BGP’s path attributes are highly flexible. They allow different paths to be chosen based on a wide range of factors, such as the number of AS hops, the preference of a particular path, as well as the origin of the path, to name a few.
- The use of BGP attributes contributes to the stability of Internet routing. For instance, the AS-Path attribute helps to prevent routing loops.
- BGP attributes like Local Preference and MED enable BGP to scale to manage the vast number of routes on the Internet, by providing mechanisms to manage traffic between different ISPs and within the same ISP.
While metrics and costs are useful in some scenarios, especially within an AS, the flexibility, granularity, and policy-based capabilities of BGP attributes make them particularly suited to the complexity of inter-domain routing on the Internet.
The granularity, flexibility, and policy-based control provided by BGP attributes are fundamental to the effective operation of the Internet, offering a nuanced approach to route selection that goes beyond simple cost or metric-based methods.
These attributes ensure the stability, scalability, and adaptability of Internet routing, thereby proving to be a vital part of the complex and evolving global Internet architecture.
- What is Link Aggregation (LAG) in Networking?
- Unveiling the Significance of Network Automation in Contemporary Networking
- Comparison of Reported Distance vs Feasible Distance in EIGRP
- BGP Multihoming – Influencing Enterprise to ISP Routing Using BGP
- The Most Important Border Gateway Protocol (BGP) Timers Explained