CCNP-Studies
Routing
4-BGP
7 Finite State Machine Fsm

BGP Finite State Machine (FSM)

Idle:

  • Initial State: The Idle state is the initial state of the BGP FSM.
  • Definition: The FSM (Finite State Machine) for BGP is defined in Section 8.2 of RFC 4271, which is the standard for BGP.
  • Status: In this state, the router is not actively attempting to establish a BGP session.
  • Trigger Events: Transition to another state typically occurs when a "start event" happens. This could be the interface moving to an "up" state or the router administrator entering the "neighbor" configuration command.
  • Error Handling: If there are errors, the FSM returns to the Idle state. Errors could include the interface being shut down, which generates a NOTIFICATION message.

Connect:

  • Description: The Connect state involves the router waiting for the successful completion of its TCP 3-Way Handshake.
  • Actions: The router listens for incoming TCP sessions on port 179, which is the default port for BGP.
  • Outcome: The outcome in this state depends on the result of the TCP session transport:
    • If the TCP session setup fails, BGP transitions back to the Active state.
    • If the TCP session setup succeeds, BGP transitions to the OpenSent state.

Active:

  • Status: In the Active state, BGP is waiting for the TCP session to establish.
  • Action: It waits for the ConnectRetry timer to expire before transitioning back to the Connect state.
  • Transition: When the TCP transport comes up, BGP transitions to the OpenSent state.

OpenSent:

  • Description: In the OpenSent state, a BGP speaker has sent its OPEN message but has not yet received an OPEN message back from its peer.
  • Error Handling: Any errors will cause a transition back to the Idle state.
  • Role of KEEPALIVE: In this state, the KEEPALIVE message also serves the function of resetting timers.
  • Hold Time Negotiation: Hold Time is negotiated in this state, and the smaller value is always selected. If Hold Time is set to 0, the KEEPALIVE timer is not restarted.

OpenConfirmed:

  • Status: In the OpenConfirmed state, a BGP speaker has received the OPEN message from its peer but has not yet received a KEEPALIVE message.
  • Error Handling: Any errors will return the BGP speaker to the Idle state.
  • Transition: When a KEEPALIVE message is received, the BGP speaker transitions to the Established state.

Established:

  • Description: The Established state is the normal operational state of BGP, where the BGP speaker has received a KEEPALIVE message.
  • Actions: In this state, UPDATE messages are received, and the BGP session is fully operational.
  • Error Handling: Any errors will return the BGP speaker to the Idle state.
  • Timer Reset: The Hold Timer is now reset when an UPDATE or KEEPALIVE message is received.

The BGP FSM helps manage the transition of a BGP session through these states based on the events that occur during the session setup and maintenance.

For more detailed information, you can refer to the RFC 4271 section 8.2 (opens in a new tab) document, which is the official specification for BGP.