Why BGP Matters: From Basics to Cloud Routing Explained
This article introduces the Border Gateway Protocol (BGP), explains its role as the core decentralized routing protocol of the Internet, compares it with IGP and EGP, describes why and when BGP is needed in cloud environments, and details its TCP‑based operation, message types, and path‑vector mechanics.
What Is BGP?
BGP stands for Border Gateway Protocol, the core decentralized routing protocol of the Internet. It is the only routing protocol used globally on the Internet, enabling autonomous systems to exchange routing information.
Related Concepts
AS (Autonomous System) : A collection of IP networks and routers under a single administrative domain, each with a unique AS number.
IGP (Interior Gateway Protocol) : A routing protocol used within an AS, such as RIP or OSPF.
EGP (Exterior Gateway Protocol) : An older protocol for routing between ASes, now replaced by BGP.
BGP can operate as IBGP (within the same AS) or EBGP (between different ASes). Large private networks may use IBGP, while the public Internet relies on EBGP.
Why BGP Is Needed
Consider a cloud provider building virtual machines (VMs). Early versions use NAT and port forwarding, which quickly become limited as the number of VMs and required ports grows. By acquiring its own public IP pool and AS number, the provider can use BGP to announce routes to multiple ISPs, ensuring redundancy and scalability.
With BGP, the cloud’s routers can dynamically advertise reachability for its IP prefixes, allowing ISPs to forward traffic correctly to the provider’s network.
BGP Protocol Details
BGP is an application‑layer protocol that runs over TCP (default port 179), providing reliable transmission of large routing tables. Its TCP window size of 65 KB allows efficient bulk data transfer, unlike some interior protocols that send one packet at a time.
A BGP message consists of a 19‑byte header followed by data. There are four message types:
Open (code 1) : Sent first to establish a BGP session, includes AS number and hold time.
Update (code 2) : Carries new or withdrawn route information; the first Update exchanges the full routing table.
Notification (code 3) : Indicates an error and terminates the session.
Keepalive (code 4) : Empty data messages sent periodically to maintain the session.
How BGP Works
BGP is a path‑vector protocol. Each BGP router stores received routes in its local database. When a route’s AS path contains the router’s own AS number, the route is discarded to prevent loops.
Routers apply local policies to select the best path among multiple routes to the same destination, often preferring the shortest AS path. The chosen route is then installed in the main routing table, and the router advertises the route to its peers, adding its own AS number and updating the next‑hop.
Thus, BGP continuously propagates reachability information across the Internet, enabling large‑scale, decentralized routing.
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.