BGP can be likened to the GPS system of the internet, overseeing the transmission of data across the vast digital landscape. It serves as a guiding force, directing information through the most efficient pathways, much like how a GPS navigates the best route for a vehicle. For instance, when you send a text message with images to a friend abroad through a messaging app, the data traverses various countries before reaching its intended recipient. BGP plays a pivotal role in orchestrating this intricate journey, ensuring that your data takes the most effective route across diverse networks.

In this article, we delve into the inner workings of BGP, shedding light on its mechanisms and functionalities. By understanding the nuances of BGP, you’ll gain insight into how your data can seamlessly and reliably navigate the intricate network of the internet.



Despite the seamless nature of our daily interactions with the internet, its functionality hinges on a sophisticated infrastructure that enables the swift transfer of data. This infrastructure encompasses a complex mesh of fiber optic cables spanning countries and continents, complemented by cellular towers and, in remote regions, satellite transmission.


Below this tangible foundation, diverse industries coordinate complex procedures to leverage the complete capabilities of this infrastructure. Among these procedures, routing emerges as a pivotal and fundamental function, enabled by routing protocols. Routing entails the systematic transfer of data packets from their origin to their designated endpoint. At the crux of internet routing resides the Border Gateway Protocol (BGP), which serves as the focal point of discussion in this article.


How BGP Functions

Put simply, BGP facilitates communication between different segments of the internet, each having its distinct set of IP addresses, akin to unique identification numbers. BGP compiles these identifiers and maintains them within a centralized database. When data necessitates transmission from one location, referred to as an autonomous system, to another on the internet, BGP consults this database to determine the most efficient route for the transfer.

Now, let’s delve deeper into this process. To comprehensively grasp the mechanics of BGP, it’s essential to first comprehend the concept of an autonomous system (AS) within the networking realm. Visualize it as a segment or zone of the internet overseen by a service provider, enterprise (such as banks or corporations), or an institution (like universities or non-profit organizations). High-tier service providers, like Arelion (ex-Telia), NTT, and Deutsche Telekom, function as the internet’s backbone, with numerous companies and local providers establishing connections with them to form mutual network links. These connected entities collectively form a network comprising thousands of ASes, where certain ASes serve as primary backbone entities (ISPs), while others function as smaller ASes or localized regions.

Each autonomous system (AS) oversees and manages its distinctive address space, comprising a series of IP addresses unique to that specific AS. The exchange of IP address ranges among ASes is a primary function facilitated by BGP. BGP’s core responsibility lies in enabling this exchange, sharing its own AS’s unique addresses with other ASes and concurrently acquiring IP address data from them.

The information pertaining to IP addresses is referred to as a “route” or a “prefix” when accompanied by its length or subnet mask. As BGP receives these routes, it incorporates them into its database, which encompasses both the routes and the respective ASes from which they originated. Routes can be likened to roads, whereas autonomous systems are analogous to cities.

BGP Peering

Routers, acting as high-performance data transfer devices, receive our data and determine the most efficient path to ensure swift delivery to the intended destination. Leveraging BGP, routers establish connections, commonly referred to as “peering,” with other BGP routers. Throughout this peering process, they exchange all the IP routes stored within their respective databases, aiming to identify the most optimal routes as suggested by the neighboring networks.

The primary objective is to minimize the number of BGP autonomous systems (ASes) traversed, as a lower count indicates an improved path. Network operators strive to directly establish peering relationships with route owners, thereby reducing additional AS hops. In cases where a router encounters multiple routes with the same prefix from several neighboring autonomous systems, only the most optimal route wins the competition and gets installed in the BGP database. Consequently, if one of the neighbors fails, the second-best route assumes the role within the database, highlighting the robustness of BGP’s functionality.


BGP Route Selection

Analogous to a GPS system guiding data packets along the most efficient paths across the internet, BGP relies on specific path attributes that define the characteristics of each route. These attributes serve as crucial metrics in the algorithm that determines the optimal route. Let’s examine some of the key attributes that BGP considers during the route selection process.

Weight: A proprietary attribute exclusive to Cisco, the Weight metric remains internal to individual routers and is not communicated to neighboring routers.

Local Preference: This attribute typically defaults to a value of 100. Assigning a higher value to a route elevates its priority within the network. The Local Preference value disseminates to all routers within the autonomous system (AS), effectively establishing the preferred exit point from the AS.

AS Path Length: Represents the count of autonomous systems a data packet must traverse en route to its destination. Shorter AS Path Lengths are generally favored.

Origin: Indicates the source of the route information, whether obtained from another routing protocol such as OSPF or directly from BGP.

MED (Multi-Exit Discriminator): This metric allows routers outside an AS to assess the most efficient entry point into that AS.

These attributes collectively empower network operators to make informed decisions, enabling them to regulate traffic patterns within their organizations using BGP, thus ensuring efficient data transmission. This approach can also lead to cost savings for companies. By configuring path attributes, organizations can prioritize more economical links over pricier alternatives, simply by adjusting weight or local preference values on routers.


Attribute Priority

When applying the aforementioned attributes to incoming routes from BGP neighbors, a clear routing policy emerges. This process involves the consideration of multiple attributes in a sequential manner, based on their respective numeric values. Within a routing policy, distinct numerical values can be allocated to different sets of routes, guided by various BGP attributes. For instance, one set of routes might be assigned a Local Preference value of 150 to indicate high priority, while another set could be designated with a Weight value of 200. These numerical values serve as criteria for the routing algorithm to determine the path that data packets should traverse.

If multiple routes possess different Weight values, the route with the highest Weight is chosen, and the process terminates there. Local Preference, AS Path Length, and other attributes are not taken into consideration for these routes.

However, if all routes share the same Weight value or if Weight is unset (which might occur with routers from vendors other than Cisco, as Weight is specific to Cisco,) the routing decision proceeds to the next attribute in the hierarchy, which is Local Preference. At this stage, the route with the highest Local Preference is selected, and the lower-priority attributes are disregarded.

Hence, when the routing policy assigns a Local Preference value of 150 and a Weight value of 200, it’s not about one being inherently superior to the other. Instead, it hinges on which attribute will be prioritized based on the hierarchical order. Weight takes precedence over Local Preference, and if Weight alone can determine the best route, Local Preference doesn’t come into play.


Throughout this article, we have explored the indispensable role of the Border Gateway Protocol (BGP) in orchestrating the routes and packets across the internet. From its initial inception with just a few thousand routes in public networks to the present day with over 930,000 routes, BGP’s extraordinary scalability mirrors the expansive growth of the internet and our global interconnectedness. As technology continues to advance and the world becomes more interconnected, BGP remains a steadfast, efficient, and reliable component of our digital infrastructure.

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *