Understand BGP Finite State
Understand BGP finite state
IE | Description |
---|---|
1 | BGP Start |
2 | BGP Stop |
3 | BGP Transport connection open |
4 | BGP Transport connection closed |
5 | BGP Transport connection open failed |
6 | BGP Transport fatal error |
7 | ConnectRetry timer expired |
8 | Hold timer expired |
9 | Keepalive timer expired |
10 | Receive Open message |
11 | Receive Keepalive message |
12 | Receive Update message |
13 | Receive Notification message |
Idle state
BGP always begin at idle state, which refuses all incoming connection. When BGP start event (IE 1
) occured. BGP will initialise and start ConnectRetry
timer. It initialise TCP connection to the neighbor, and listen for TCP connection from the neighbor as well.
Start event (IE 1
) can be done by:
- Operator restart BGP
- Operator re-configure BGP
- Router re-try again after failure that led to
Idle
state. Given the condition that theConnectRetry
timer expired. IOS initialConnectRetry
is 120 seconds
Connect state
BGP process is waiting for TCP connection to the neighbor to be completed. If TCP connection.
If connection is
- Successful, it will clear
ConnectRetry
timer and send BGP Open Message and transition toOpenSent
state - Unsuccessful, BGP will resets the
ConnectRetry
timer and actively listen to connection initialised by the neighbor. It will transition to Active state
If the ConnectRetry
timer expire, it will reset the timer and make another attempt for TCP connection. The above condition loops back.
Active state
BGP process tries to initiate TCP connection. If TCP connection is successful, it will clear ConnectRetry
timer and complete initialisation, send BGP Open Message to the neighbor and transition to Open Sent
The IoS default Hold time
is 180 seconds and can be changed with timers bgp statement
If ConnectRetry
timer expires while BGP in active state, it will transition back to Connect
state and reset the ConnectRetry
timer
IF the neighbor atteempts to establish a TCP connection with an unexpected IP address, ConnectRetry
timer is reset and the process stay in Active
state
OpenSent state
BGP Open Message has sent, BGP is waiting to hear an Open from the neighbor. When the message is received, it will check the fields of the Open message.
If there is any error, we transit to Idle
state, a Notification
message is sent
If no error, Keepalive
message is sent and keep alive timer is set. Hold time
is negotiated.
If the negotiated Hold time
is zero, the Hold
and Keepalive
timers are not started, the peer connection will be determine either internal or external. Based on AS number, the tate is changed to OpenConfirm
If TCP disconnection received, local process closes the BGP connection, resets ConnectRetry
timer and begin listen for new connections, Transition to Active
.
OpenConfirm
BGP process waits for Keepalive
or Notification
message. If Keepalive
received, we transition to Established
.
If Notification
is received or TCP disconnec
is received, we changed to Idle
Established State
BGP are fully established and can excahnge KeepAlive
, Update
, Notification
If Update
or Keepalive
message received, Hold timer
is restarted
If Notification
received, we change to Idle