What Is BGP? How Border Gateway Protocol Works

The internet depends on a complex routing system to move data reliably between networks around the world. At the centre of this system is Border Gateway Protocol BGP,, the protocol responsible for directing traffic across the global internet.But what is BGP, and why does it matter for network performance and enterprise connectivity? Join Axclusive ISP as we explore how this critical routing protocol keeps the internet running. 

What is BGP?

The Border Gateway Protocol (BGP) is the core routing protocol of the global internet, responsible for directing how data travels between networks. It is the mechanism that enables thousands of independent networks—known as Autonomous Systems (ASes)—to exchange reachability information with one another. By evaluating all available paths based on policy and attributes, BGP selects the optimal route for traffic to take from its source to its destination. This dynamic path-selection process is the foundation of global connectivity, ensuring a user’s request on one continent can reliably and efficiently reach a server on another.

What is BGP

BGP Autonomous Systems and Operators

An Autonomous System (AS) is a large, independent network or group of networks operated by a single administrative entity. These are the building blocks of the internet, typically run by Internet Service Providers (ISPs), major technology companies, universities, or government agencies. The engineers managing the routing policies for these networks are the BGP operators.

To participate in global routing, each AS must have a unique identifier called an Autonomous System Number (ASN). The allocation of these numbers is a governed process: the IANA allocates blocks of ASNs to Regional Internet Registries (RIRs), which then assign them to network operators. Available in both 16-bit and 32-bit formats to support the internet’s growth, this ASN is the public identifier used to establish external BGP (eBGP) sessions and exchange routing information between distinct networks.

What is the difference between external BGP and internal BGP?

The distinction between External BGP (eBGP) and Internal BGP (iBGP) is based entirely on where the connection is established: between different networks or within a single network.

External BGP (eBGP) is the protocol’s primary function, used to establish routing sessions between two distinct Autonomous Systems. This is how ISPs, content providers, and enterprises exchange reachability information with their external peers, forming the backbone of the global internet routing table.

Internal BGP (iBGP) operates within a single Autonomous System. Its specific purpose is to distribute external routes—those learned via eBGP from other networks—to all other routers inside its own AS. This ensures that every router in the network has a consistent view of external paths, enabling consistent outbound routing. While eBGP is mandatory for internet connectivity, an AS can use other protocols (IGPs) for its internal routing; iBGP is specifically for propagating those external routes.

Why is Border Gateway Protocol important?

Border Gateway Protocol is the single most important protocol for the internet’s global operation. It provides the essential framework that allows thousands of independent Autonomous Systems to function as a single, cohesive network. Its importance stems from several core capabilities:

  • Policy-Driven Routing: Unlike other protocols that focus solely on the shortest or fastest path, BGP enables network operators to make routing decisions based on business policies, cost, and traffic agreements. It finds the most efficient route according to an organization’s specific needs, which is critical for managing the economics of internet traffic.
  • Global Scalability and Adaptability: The internet is in a constant state of change, with new networks appearing and old ones being decommissioned. BGP is the mechanism that allows the entire internet to adapt to these changes in real-time. It dynamically maintains a current map of reachable networks, ensuring the internet can scale globally without centralized management.
  • Enhanced Network Security: BGP includes mechanisms for securing routing information. Through features like message authentication, it allows routers to verify that updates are coming from legitimate peers. This helps prevent route hijacking and unauthorized traffic, forming a foundational layer of trust in inter-network communication.

How BGP Routing Works

BGP routing operates on a principle called peering, where designated routers at the edge of an Autonomous System (known as BGP speakers) establish direct sessions with their counterparts in other networks. This process follows a structured, three-stage approach to exchange, evaluate, and select the best routes.

  • Peering and Route Advertisement: First, two BGP peers establish a reliable connection using TCP. Once this session is active, they begin exchanging routing information. This information consists of Network Layer Reachability Information (NLRI), which are the IP address prefixes the router can reach, and a corresponding set of Path Attributes, which describe the characteristics of the path to get there (e.g., which ASes it crosses).
  • Route Storage and Maintenance: Each BGP router receives these advertisements from its peers and stores all learned paths in its BGP Routing Information Base (RIB), or BGP table. This table provides a complete view of all possible routes to a destination. The peering session is actively maintained with periodic “keep-alive” messages. If these messages cease, the router assumes the peer is unreachable and invalidates all routes learned from it.
  • Best-Path Selection: For each destination prefix in its table, the router executes its best-path selection algorithm. This is a deterministic process that evaluates the path attributes in a specific order. While a primary factor is selecting the path that traverses the fewest Autonomous Systems (the shortest AS_PATH), the algorithm also considers policy-based attributes like local preference and MED. The single “best” path that results from this process is then installed in the main routing table and used to forward live traffic.

BGP Session Types

BGP connections are categorized into two distinct session types, defined by whether the peering takes place between different networks or within a single network.

  • External BGP (eBGP): This is the session type established between routers in different Autonomous Systems. This is the primary function of BGP, used to connect an organization’s network to its Internet Service Providers, cloud providers, and other external peers. An eBGP session is how an AS advertises its IP prefixes to the global internet and learns routes from the rest of the world.
  • Internal BGP (iBGP): This is the session type established between routers within the same Autonomous System. Its sole purpose is to distribute the external routes—those learned via eBGP—to all other routers inside its own network. This ensures consistent outbound routing. The critical difference lies in the route propagation rule: a route learned from an iBGP peer is not re-advertised to another iBGP peer by default. This split-horizon rule is a loop-prevention mechanism and is why iBGP requires specific designs like a full mesh or route reflectors.

Key Characteristics of BGP

Border Gateway Protocol is the standard for inter-domain routing due to a unique set of design characteristics that prioritize policy, scalability, and reliability over simple speed metrics. These features distinguish it from all other routing protocols.

Inter-Autonomous System Operation

BGP’s primary design function is to facilitate communication between distinct Autonomous Systems (ASes). It is the only protocol used today to connect the thousands of independent networks that form the global internet, enabling them to exchange routing information and forward traffic to one another.

Next-Hop Routing Model

BGP operates on a next-hop basis. When a BGP router advertises a route, it includes the IP address of the next router (the “next hop”) that should be used to reach that destination. This allows for simple and efficient forwarding decisions, as a router only needs to know the immediate next step in the path, not the entire end-to-end route.

Coordination Between BGP Peers

Within a single Autonomous System, Internal BGP (iBGP) ensures all routers have a consistent and complete view of external routes. This coordination is essential for making uniform routing decisions, preventing loops, and ensuring that outbound traffic follows the correct policy regardless of which edge router it exits.

Path-Based Routing Information

Unlike other protocols that use a simple cost metric, BGP makes decisions based on path information. Every route advertisement includes the AS_PATH attribute, which is a list of all Autonomous Systems the route has traversed. This provides a loop-free path vector and is a primary factor in the best-path selection process.

Policy-Driven Route Control

BGP is fundamentally a tool for policy enforcement. Administrators can use a rich set of attributes (like Local Preference, MED, and Communities) to influence the route selection process based on business requirements, such as cost, traffic agreements, or performance preferences, rather than just the shortest path.

TCP-Based Transport

BGP runs over the Transmission Control Protocol (TCP) on port 179. Using TCP provides a reliable, connection-oriented transport mechanism, guaranteeing that routing updates are delivered completely and in the correct order. This eliminates the need for the protocol to manage its own reliability and retransmission logic.

Bandwidth-Efficient Updates

BGP conserves network bandwidth by using a trigger-based update model. A BGP router sends routing updates only when a change in the network occurs (e.g., a path goes down or a new one becomes available). It does not send periodic, full routing table refreshes, which makes it highly efficient for managing the massive internet routing table.

CIDR Compatibility

BGP was designed to support Classless Inter-Domain Routing (CIDR). This allows it to work with variable-length subnet masks, enabling the efficient allocation and aggregation of IP address space. This capability is essential for managing the global IP address pool and keeping the internet’s routing table a manageable size.

Built-In Security Support

While the base protocol has known vulnerabilities, BGP includes foundational support for security. This includes the ability to authenticate peering sessions between routers using a pre-shared key (MD5). This feature provides a basic layer of verification and serves as a platform for more advanced security frameworks like RPKI (Resource Public Key Infrastructure).

Border Gateway Protocol is the fundamental mechanism that underpins the global internet. By enabling thousands of independent Autonomous Systems to exchange routing information based on policy, BGP ensures that data travels efficiently and reliably across the world. A solid grasp of its principles is therefore essential for any network professional. This comprehensive guide from Axclusive provides the foundational knowledge needed to navigate the complexities of inter-domain routing, empowering you to build a more resilient and performant network.

🌍 Want to understand how BGP impacts your network performance? Contact us today to optimise your routing strategy and strengthen your enterprise connectivity. 

Back to blog