Latest

BGP Basics: BGP Neighbor States

BGP Neighbor States 
Border gateway Protocol

Today we are going to talk about BGP Neighbor States and the reasons for the issues if BGP stuck in that state. Let's start with the BGP first and then we will discuss on the BGP states 

BGP: Border Gateway Protocol
BGP is external gateway protocol to exchange the routes between the two organizations having different AS(autonomous systems) numbers. The connection is setup up with the setting up the peers between the two organizations.

BGP Neighbor States
Connection passes 6 states for BGP to be an established state. These states are below 

  • Idle
  • Connect
  • Active
  • OpenSent
  • OpenConfirm
  • Established
BGP Basics: BGP Neighbor States
Fig 1.1- BGP Basics: BGP Neighbor States 

Another way of looking the BGP states as below 
Fig 1.2- BGP Neighbor States

State 1: Idle
In the idle state, BGP tries to initiate a TCP connection to the BGP peer and listens for a new connection from a peer router. If it fails, Connect Retry Timer is set to 60sec and must reach 0 before trying again. Each subsequent failure doubles the time. 

So once connection failed, you need to wait for 60 seconds for BGP start initiating the other TCP connection to its peer.

State 2:Connect
In this state, A 3 way handshake is completed and it resets ConnectRetry Timer and sends OPEN message to neighbor. If this is successful, the connection will be changes to OpenSent and if ConnectRetry Timer depletes, a new TCP connection is attempted, Connect Retry Timer is reset and state moves to ACTIVE.

State 3:Active
In this state, a new TCP 3 way handshake. If connection establishes, an OPEN is sent, hold timer set to 4min and state moves to OPENSENT. If TCP connection fails, moves back to CONNECT and Connect Retry Timer reset.

State 4:Opensent
In this state, An OPEN has been sent and an OPEN from the other router is expected. Once OPEN has been received, they are both checked for errors like BGP version number is same on both ends, Source IP address of OPEN message matches the configured neighbor IP Address, ASN of OPEN message matches the configured neighbor ASN.

BGP Router-IDs must be unique and Security parameters (authentication) and TTL must be set correctly.

If there are no errors, hold time is negotiated and then state moves to OPENCONFIRM.

State 5:Openconfirm
Here in this state, BGP waits for KEEPALIVE or NOTIFICATION and If KEEPALIVE is received, state moves to ESTABLISHED and If hold timer expires, stop event occurs or NOTIFICATION is received, state moves to IDLE

State 6: ESTABLISHED
So this is the final state of the BGP connection and BGP neighbors exchange routes using UPDATE messages. As UPDATES and KEEPALIVES are received, hold timer is reset. If hold timer expires or an error detected, state goes to IDLE.