Border Gateway Protocol (BGP): Enabling Inter-Domain Routing on the Internet

Deep dive into Border Gateway Protocol (BGP), the routing protocol that powers internet connectivity. This guide explains BGP's role in inter-domain routing, its path-vector routing mechanism, autonomous systems (ASes), and how it prevents routing loops.



Border Gateway Protocol (BGP): Inter-Domain Routing on the Internet

Introduction to BGP

BGP (Border Gateway Protocol) is the routing protocol that enables communication between different autonomous systems (ASes) on the internet. An AS is a collection of networks under a single administrative domain. BGP uses path-vector routing, meaning it exchanges routing information, including the path taken to reach a destination, allowing for complex routing decisions across the internet.

History of BGP

Early internet routing (in ARPANET) was simpler, with a single administrator managing all routers. The Gateway-to-Gateway Protocol (GGP) was used, but as the internet grew, this became unmanageable. This led to the creation of Autonomous Systems (ASes)—independent network domains—each with its own routing policies. The Exterior Gateway Protocol (EGP) initially connected these ASes, but it also faced scaling issues. BGP emerged in 1989 to address these limitations and provide a more robust and scalable inter-domain routing solution.

BGP Versions

  • BGP Version 1 (RFC 1105)
  • BGP Version 2 (RFC 1163)
  • BGP Version 3 (RFC 1267)
  • BGP Version 4 (RFC 1771) - Current version

Autonomous Systems (ASes)

An AS is a group of networks under the same administrative control. Each AS has a unique number. Interior Gateway Protocols (IGPs) handle routing within an AS, while BGP handles routing between ASes.

Key Features of BGP

  • Open Standard: Works on various networking devices.
  • Exterior Gateway Protocol: Exchanges routing information between ASes.
  • Inter-domain Routing: Enables routing across multiple ASes.
  • Classless: Supports VLSM (Variable Length Subnet Masking).
  • Path-Vector Protocol: Sends routing information including path details.
  • Manual Neighbor Configuration: Requires manual setup of connections between BGP routers.
  • Application Layer Protocol: Uses TCP for reliable communication.

BGP Loop Prevention

BGP prevents routing loops by ensuring that a router won't accept a route that includes its own AS number. This simple check ensures that routes don't cycle endlessly through the same ASes.

Types of Autonomous Systems

  • Stub AS: Connects to only one other AS.
  • Multihomed AS: Connects to multiple ASes but doesn't route traffic between them.
  • Transit AS: Connects to multiple ASes and routes traffic between them.

BGP Path Attributes

BGP uses path attributes to determine the best route. Attributes are classified as:

  • Well-known Attributes: Essential information like the AS path and next hop.
  • Optional Attributes: Additional information that may not be supported by all routers.

BGP Neighbors and Tables

BGP routers exchange information with their neighbors.

  • IBGP (Internal BGP): Neighbors within the same AS.
  • EBGP (External BGP): Neighbors in different ASes.

BGP maintains these key tables:

  • Neighbor Table: Information about configured neighbors.
  • BGP Forwarding Table: Routes learned through BGP.
  • IP Routing Table: The best routes to reach destinations.

BGP Sessions and Packets

BGP uses sessions to exchange information between neighbors. BGP packets include:

  • Open: Initiates a BGP session.
  • Update: Announces new or withdrawn routes.
  • Keepalive: Maintains the session.
  • Notification: Indicates errors or session termination.

BGP Packet Format

A BGP packet contains:

  • Marker: For authentication.
  • Length: Packet size.
  • Type: Indicates the packet type (Open, Update, etc.).