Skip to main content

BGP Neighbor State Machine

·378 words·2 mins
lab1918
Author
lab1918

The BGP (Border Gateway Protocol) Neighbor State Machine is a finite state machine that describes the stages of a BGP session between two routers (peers). The state machine consists of several states through which a BGP connection progresses. Below is a text-based representation of the BGP Neighbor State Machine:

+------------+     +------------+     +-------------+
|            |     |            |     |             |
| Idle       +-----> Connect    +-----> Active      |
|            |     |            |     |             |
+-----+------+     +-----+------+     +------+------+
      |                  |                   |
      |                  |                   |
      |                  |                   |
      |                  |                   |
      |                  |                   |
      v                  v                   |
+-----+------+     +-----+------+            |
|            |     |            |            |
| ConnectRetry|<--->OpenSent    +<-----------+
|            |     |            |
+-----+------+     +-----+------+
      |                  |
      |                  |
      | OpenConfirm      |
      |                  |
      |                  |
      v                  v
+-----+------+     +-----+------+
|            |     |            |
| Established|<--->| OpenConfirm|
|            |     |            |
+------------+     +------------+

Description of States:
#

  1. Idle: The initial state. No resources are allocated for the BGP session. In this state, BGP refuses all incoming BGP connections and does not attempt to initiate a BGP connection.

  2. Connect: In this state, a TCP connection is initiated to the BGP peer. If successful, the state progresses to OpenSent, otherwise to Active.

  3. Active: If the TCP connection was unsuccessful, the state transitions to Active. In this state, BGP continues to try to establish a connection with the peer.

  4. ConnectRetry: This is a transient state where the BGP process is waiting to retry a connection attempt. After the retry timer expires, BGP transitions back to the Connect state.

  5. OpenSent: Once the TCP connection is successful, BGP sends an Open message and transitions to this state. In OpenSent, BGP waits for an Open message from its peer.

  6. OpenConfirm: After receiving and validating the Open message from the peer, the state transitions to OpenConfirm. In this state, BGP waits for a Keepalive or a Notification message from its peer.

  7. Established: The final state where the BGP peers exchange Update messages. This state indicates a fully established BGP session. In the Established state, the routers can exchange routes and maintain the connection through Keepalive messages.

If at any point an error is detected or a stop event occurs, BGP transitions back to the Idle state. The transitions between these states are governed by BGP messages, session parameters, and error conditions.