BGP (Border Gateway Protocol)

Border Gateway Protocol (BGP) is a standardized exterior gateway protocol used to exchange routing information between different autonomous systems (ASes) on the internet. It is standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the Internet.  It is classified as a path vector protocol and is defined in several RFCs, with BGP-4 being the most widely used version today.

How does BGP Work?

  • Session Establishment:
    • BGP routers establish a TCP connection to exchange routing information. This connection is established on port 179.
    • Once the connection is up, BGP routers use various types of messages to communicate.
  • BGP Messages:
    • OPEN: Initiates the BGP session and exchanges parameters such as AS number and BGP version.
    • UPDATE: Used to advertise new routes or withdraw routes that are no longer available.
    • KEEPALIVE: Maintains the session by ensuring that the connection remains active.
    • NOTIFICATION: Alerts the peer about errors or issues with the BGP session.
  • Route Advertisement:
    • BGP routers exchange routing information with their peers. This includes details about available paths and various attributes that help in selecting the most efficient route.
  • Path Selection:
    • BGP uses attributes such as AS Path (a record of ASes a route has traversed), Next Hop (the next router to reach the destination), and Local Preference (preference within the AS) to determine the best route for data packets.
    • The router evaluates these attributes to make routing decisions, ensuring efficient and reliable data transmission.
  • Route Aggregation and Filtering:
    • BGP supports route aggregation to reduce the size of routing tables by combining multiple routes into a single, summarized route.
    • It also allows for route filtering to control which routes are advertised or accepted, improving network performance and security.