DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Mastering BGP Neighborship: Effective Troubleshooting Strategies
  • Architecting Sub-Microsecond HFT Systems With C++ and Zero-Copy IPC
  • Build High-Performance Web Systems Using Adaptive Edge-Native Performance Governance Framework
  • Hadoop on AmpereOne Reference Architecture

Trending

  • Leveraging Apache Flink Dashboard for Real-Time Data Processing in AWS Apache Flink Managed Service
  • From APIs to Actions: Rethinking Back-End Design for Agents
  • Tactical Domain-Driven Design: Bringing Strategy to Code
  • Microservices: Externalized Configuration
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. Navigating the Border Gateway Protocol: Understanding BGP Neighborship States

Navigating the Border Gateway Protocol: Understanding BGP Neighborship States

Border Gateway Protocol is a routing protocol used to form communication between different Autonomous Systems on the internet.

By 
Sanjay Poddar user avatar
Sanjay Poddar
·
Jun. 14, 24 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
3.5K Views

Join the DZone community and get the full member experience.

Join For Free

Border Gateway Protocol is a routing protocol used to form communication between different Autonomous Systems on the internet. BGP works over a TCP connection and goes through multiple steps to establish and maintain a session. Let's dive in to understand it.

Topology:

topology

Detailed BGP neighborship states:

Detailed BGP neighborship states

Idle

This is the initial stage of the BGP process, in Idle state the BGP process anticipates a start event. BGP is not proactively looking to connect with its BGP neighbor. The BGP process is also checking for any errors or misconfiguration which could prevent it from forming a neighborship with its peer. Once checks are completed, BGP progresses to the Connect state. The router now attempts to establish a TCP connection, if established, it transitions to the next stage which is the Open Sent state, where BGP messages are exchanged. Once open messages are exchanged, the session transitions to the Open Confirm state and then finally to the Established state, where BGP routes are exchanged. Remember, if any errors get identified the BGP session falls back to the Idle state.

Connect

BGP process when it transitions from Idle to Connect state, its attempts to establish a TCP connection with its neighbor. A ConnectRetry timer is configured for connection attempts. If a TCP connection is not established before the timer expires, the session transitions to an Active state. When established, an Open message is sent, transitioning the session to OpenSent. If it fails, the router might attempt again, revert to Idle, or switch to Active based on the retry policy.

Active

In the Active state, the BGP process actively keeps trying to form a TCP connection in this state. The router might go back and forth between Connect and Active state all the while trying to establish a connection. Once the connection is established, the router sends an Open message and transitions to OpenSent. Repeated failures can lead the router to return to Idle to avoid excessive retries.

OpenSent

When the transition to the OpenSent state is completed, the router sends an Open message to its peer which contains BGP-related info such as BGP version, AS number, hold timer, BGP identifier, and optional parameters. The open messages are exchanged. The received open messages are validated, essentially checking for compatible BGP versions, and acceptable AS numbers, and verifying the configuration for errors. If the parameters in the Open message are accepted, the router sends a Keepalive message and moves on to the OpenConfirm state.

OpenConfirm

In the Open Confirm state, the router is on standby, waiting for a Keepalive message from its peer. This message confirms that the session parameters are all good and the peer is ready to continue. The router has a hold timer running, and if it doesn’t get the Keepalive message within this period, it will send a Notification message and revert to the Idle state. A BGP hold timer is a mechanism that monitors how long it's been since a router received a successful keepalive message. However, if the Keepalive message does come through on time, the router responds with its own Keepalive message and then transitions to the Established state.

Established

Once the BGP session hits the Established state, it's fully up and running. The routers will swap Update, Keepalive, and Notification messages as necessary. Update messages handle the exchange of routing information, announcing new routes and withdrawing old ones that are no longer valid. Keepalive messages are sent regularly to make sure the session stays active, with the timing based on the agreed-upon hold time. If something goes wrong, like invalid route info or if the peer stops responding, a Notification message is sent, and the session might drop back to the Idle state. As long as everything is running smoothly and no errors pop up, the routers will keep exchanging routing info in the Established state.

Border Gateway Protocol Protocol (object-oriented programming) systems Performance

Opinions expressed by DZone contributors are their own.

Related

  • Mastering BGP Neighborship: Effective Troubleshooting Strategies
  • Architecting Sub-Microsecond HFT Systems With C++ and Zero-Copy IPC
  • Build High-Performance Web Systems Using Adaptive Edge-Native Performance Governance Framework
  • Hadoop on AmpereOne Reference Architecture

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook