BGP States Explained

BGP, or Border Gateway Protocol, is an important protocol in the networking world. It is responsible for exchanging routing information between autonomous systems on the Internet. As such, it is important for network engineers to understand the basics of BGP states and how they transition between each other.

Let’s get started.

BGP States Explained

This section will give you details related to the BGP states, and then the following section will discuss how BGP transitions between them.

First, there are six main states of a BGP session: Idle, Connect, Active, OpenSent, OpenConfirm, and Established. It is important to understand how each of these states works and how they transition between each other to utilize BGP effectively.

Idle State:

  • What is Idle State: This is the initial state of a BGP session and Indicates the router is currently not attempting any connection establishments.
  • When a BGP enters Idle State: This is the initial state. The router comes out of the Idle state when someone configures a new BGP peer or resets an established BGP peering.
  • What happens in BGP Idle state: In the Idle state, BGP waits for a start event to occur. This could be when someone configures a new BGP neighbor or resets an existing peering. BGP sets a ConnectRetry timer and attempts to establish a TCP connection with its remote peer. It also listens for any incoming connections from the remote peer. If the connection is successful, BGP moves onto the Connect state; if it fails, it remains in Idle.

Connect State:

  • What is Connect State: Connect State Indicates the router is waiting for the TCP connection to be completed. If successful, an OPEN message is sent.
  • When a BGP enters Connect State: After the Idle state.
  • What happens in the BGP Connect state: In the BGP Connect state, routers wait for a successful TCP connection. If this is achieved, an OPEN message is sent, and the router moves to OpenSent. If the connection fails, it goes back to Active. If the ConnectRetry timer expires without a successful connection, BGP tries again by resetting the ConnectRetry and initiating a new TCP three-way handshake. The process continues until either a successful connection is established or BGP is reset, in which case it will return to idle.

Active State:

  • What is Active State: Indicates the router didn’t receive agreement on parameters and is trying to initiate TCP.
  • When a BGP enters Active State: When BGP fails to establish a connection in the Connect state.
  • What happens in BGP Active state: Indicates the router didn’t receive agreement on parameters of establishment and is trying to initiate TCP. BGP will try a new TCP three-way handshake with its remote peer. If successful, it enters OpenSent. If ConnectRetry expires, it returns to Connect state. BGP also listens for incoming connections if a remote neighbor tries to connect.

OpenSent State:

  • What is OpenState: After the TCP session is set up, the router waits for an OPEN message to confirm all parameters. If there are no errors, a BGP keepalive message is sent.
  • When a BGP enters OpenSent State: After BGP has successfully established a TCP connection with its peer in the Connect or Active state.
  • What happens in BGP OpenSent state: BGP enters the Opensent state and waits for an Open message from the remote neighbor. If something is wrong (incorrect version numbers, wrong AS number, etc.), a notification is sent, and BGP jumps back to the Idle state. The AS number is also checked to decide between EBGP/IBGP. If OK, keepalive messages are sent, and a hold timer is negotiated. If the TCP session fails, BGP jumps to Active. If other errors occur or BGP is reset, a Notification is sent, and it jumps to Idle.

OpenConfirm State:

  • What is OpenConfirm State: Indicates the router is waiting for a keepalive or notification message. If a keepalive is received, the state changes to Established, else changes to Idle.
  • When a BGP enters OpenConfirm State: After receiving an open message from its peer in response to an open message sent in the OpenSent state.
  • What happens in BGP OpenConfirm state: BGP awaits a keepalive message from a neighbor. Once it gets the keepalive, it moves to an established state and complete neighbor adjacency. It resets the hold timeout. If a remote BGP peer notifies BGP, it returns to the Idle state. Keepalive messages are sent via BGP.

Established State:

  • What is an Established State: Indicates peering to a neighbor is established; routing begins.
  • When a BGP enters Established State: After the Openconfirm state.
  • What happens in the BGP Established state: The BGP neighbor adjacency is now complete, and the BGP routers will send BGP to update messages to share routing information. The hold timer will start over every time it gets a “keepalive” or “update” message. The BGP will return to the Idle state if it gets a notification.

Transitioning Between BGP States – BGP FSM or Finite State Machine Diagram

BGP States Explained - BGP FSM Diagram

Overview of BGP States transition process

The transition process between BGP states is a complex one, but it is essential to understand in order to configure and troubleshoot BGP networks properly.

The process begins with the Idle state, which is the initial state of a BGP router. From there, the router will move to the Connect state when it receives a connection request from its neighbor. If no response is received, it will enter the Active state and send out connection requests until a response is received. Once an open message has been sent and received, the router will enter OpenSent and OpenConfirm states before finally transitioning to Established. At this point, routing can begin, and updates can be exchanged between neighbors.

Potential issues during BGP States transitions and Troubleshooting tips for resolving issues

Potential reasons for issues during BGP state transitions can include misconfigurations, incorrect routing information, or a lack of connectivity between neighbors. To troubleshoot, it is important first to verify the configuration of both routers and ensure that they are properly configured for BGP. For example, you can check if the neighbor address and remote-as number are configured properly.

Additionally, it is important to check the underlying routing tables of both routers to make sure that they have the correct information. Remember, BGP is a TCP layer protocol, and if a neighbor is not directly connected, it needs an underlying routing to form a BGP neighborship.

It is also essential to check the physical connection between the two routers and ensure that there are no problems with the link. If any of these issues are present, they must be addressed before BGP can successfully transition between states. You should also monitor the network for any signs of packet loss or routing loops.

Finally, It is important to ensure that all routers in the network are running compatible BGP versions. 


In conclusion, the Border Gateway Protocol is a powerful routing protocol that allows network engineers to route traffic across multiple autonomous systems. However, a BGP session has several states you must understand to configure and troubleshoot BGP networks properly. The process begins with the Idle state and progresses through Connect, Active, OpenSent, OpenConfirm, and Established states before routing can begin. By understanding each of these states and their respective functions within the context of a BGP network, you can ensure efficient routing of data across multiple networks.

Leave a Reply

Your email address will not be published. Required fields are marked *