Border Gateway Protocol (BGP) is a standardized exterior gateway protocol used to exchange routing information between different autonomous systems (ASes) on the internet. It is standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the Internet.  It is classified as a path vector protocol and is defined in several RFCs, with BGP-4 being the most widely used version today.

BGP has 6 well-defined neighbor states. 

  • Idle
  • Connect
  • Active
  • OpenSent
  • OpenConfirm
  • Established

Idle

Idle is the first and default state of a BGP neighbor relationship. Idle is the initial BGP state where the router resets the session, performs basic checks, and waits to initiate a TCP connection with the neighbor.

What happens in the Idle state?

  • BGP is not attempting to exchange routing information yet
  • The router:
    • Initializes BGP resources
    • Clears any previous BGP session
    • Waits for a start event
  • Prepares to establish a TCP connection on port 179

Why does BGP enter or return to Idle?

 BGP transitions to Idle when:

  • Neighbor configuration is incorrect
  • Remote AS number mismatch
  • TCP connection fails repeatedly
  • BGP receives a NOTIFICATION message
  • Manual clear of BGP session
  • Authentication (MD5) failure
  • Hold timer expires

Connect

In BGP, the Connect state is one of the states in the BGP Finite State Machine (FSM). It happens early in the process of forming a BGP neighbor relationship. The Connect state is when a BGP router is actively trying to establish a TCP connection with its neighbor.

What happens in the Connect state?

  • The router initiates a TCP connection to the peer on TCP port 179
  • A Connect Retry timer is started
  • The router waits for the TCP session to succeed
  •  

Active

In Border Gateway Protocol (BGP), the Active state is part of the BGP Finite State Machine (FSM) and occurs when a router is actively attempting to establish a TCP connection with a BGP neighbor after a previous attempt has failed.

What triggers the Active state?

A BGP router enters the Active state when:

  • A TCP connection attempt in the Connect state fails
  • The ConnectRetry timer expires
  • The router needs to retry forming a BGP session
What happens in the Active state?
  • The router continues attempting to establish a TCP connection to the neighbor on TCP port 179
  • It listens for incoming TCP connection requests from the peer
  • The ConnectRetry timer continues running
  • No BGP routing information is exchanged
Possible transitions from the Active state
  • TCP connection succeeds
    • The router transitions to the OpenSent state
    • A BGP OPEN message is sent
  • TCP connection fails
    • The router returns to the Connect state
    • The retry process continues
  • Manual reset or fatal error
    • The router moves back to the Idle state
Importance of the Active state 

The Active state ensures:

  • BGP does not give up after a failed attempt
  • Continuous retry mechanisms are in place to form a stable neighbor relationship
  • Reliable session establishment over TCP
Mostly reasons BGP stays in Active state
  • Neighbor is unreachable (IP connectivity issue)
  • TCP port 179 is blocked by a firewall or ACL
  • Incorrect neighbor IP or AS number
  • BGP not enabled on the peer
  • Routing loop or missing route to the peer