logo

What is Border Gateway Protocol (BGP)

The Border Gateway Protocol (BGP) is the routing protocol for the Internet. It's how different networks (like Cloudflare and AWS) exchange routing information to figure out the best path for data to travel.

BGP looks at all of the available paths and picks the most efficient routes for delivering Internet traffic (like the postal service of the Internet). It is the language spoken by routers.

Border Gateway Protocol (BGP) works using a mechanism called peering. Administrators assign certain routers as BGP peer or BGP speaker routers. You can think of peers as devices on the edge or boundary of an autonomous system.

What is an Autonomous System

An Autonomous System (AS) is a smaller network under the control of a single administrative entity. You can uniquely identify such networks by their autonomous system number assigned by the Internet Assigned Numbers Authority (IANA). Data travels between autonomous systems as it moves from source to destination.

Every AS must be kept up to date with information regarding new routes as well as obsolete routes. This is done through peering sessions where each AS connects to neighboring ASes with a TCP/IP connection for the purpose of sharing routing information. Using this information, each AS is equipped to properly route outbound data transmissions coming from within.

iBGP vs eBGP

  • iBGP: internal BGP. For traffic within an AS.
  • eBGP: external BGP. For traffic between AS (i.e. over the Internet).

The main difference between internal and external BGP peering is the way the BGP route received from one peer is propagated by default to other peers.

Additionally, organizations must use external BGP to connect their corporate network to the internet.

In contrast, there is no obligation to use internal BGP. You can choose from several internal routing protocols based on your organization's networking requirements.

BGP vs IGP

  • Interior Gateway Protocols (IGP):
    • used for Transport, Underlay purposes.
    • used usually just for IPv4 and IPv6 Unicast purposes.
  • Border Gateway Protocols (BGP):
    • used for Service Layer, the Overlay mechanism.
    • used for IPv4 unicast, IPv4 multicast, IPv4 unicast, IPv6 multicast, EVPN, L2VPN, Security, Quality of Service, Multicast, and many other purposes.

Concepts

  • BGP Router / BGP Speaker: BGP Router is the physical or virtual networking device (usually a router) that is configured to run the BGP process. BGP Speaker is the software process or instance on the BGP Router that actually sends, receives, and processes BGP messages. The terms "BGP Speaker" and "BGP Router" are often used interchangeably, but "Speaker" emphasizes the function of exchanging routing information.
  • BGP Peer / Neighbor: Two BGP Speakers that have established a TCP connection on port 179 and agreed to exchange BGP routing updates are called peers or neighbors. This established connection is called a BGP Session.
  • Border Router: Any router that sits at the edge of an AS and connects to one or more routers in a different AS. These routers typically run eBGP (External BGP).
  • Prefix: A prefix is a block of IP addresses. Internet traffic is routed based on these blocks, not individual IP addresses.
  • NLRI: The term Network Layer Reachability Information (NLRI) is the BGP term for an IP address block or subnet prefix (e.g., 192.0.2.0/24). This is the "destination" being advertised.