BGP neighbor state machine

idle 
connect (TCP three-way handshake has been established) 
open sent 
open confirm 
establish 
connect and active are both TCP connection stages, active is the initiator, connect is the responder 


Idle State
1 BGP usually starts with Idle State (at this time it refuses to accept all incoming connections). When a start event occurs, the BGP process initializes all BGP resources to open the retry connection (ConnectRetry) timer, initializes the TCP connection to the neighbor, receives the TCP initialization message from the neighbor and transfers its state to Connect State
2 The start event is caused by An operator configures a BGP process, or resets an existing process or the router software resets the BGP process.
3 An error occurs will change the BGP process state to Idle State. The router may try to initiate another start event. In order to prevent the swing caused by continuous error conditions, after the first switch back to Idle State, the router will automatically start the retry connection timer. When the timer expires, the router will give up and restart BGP. Retry timer The first time is 60s, the next time is twice the previous time 120s, increasing exponentially

Connect State In
this state, the BGP process will wait until the TCP connection is completed before deciding on the subsequent 
actions.1 If the TCP connection is established successfully, the BGP connection will clear ConnectRetry, complete the initialization, and send an Open Message to the neighbor to transfer to Open send State
2 If the TCP connection If the establishment fails, BGP continues to monitor the connection initiated by the neighbor, reset the ConnectRetry timer and transfer to Active State
3 If the ConnectRetry times out in the connected state, the timer will restart, and try to establish a TCP connection with the neighbor again, BGP keeps Connect State, if there are any other input events at this time, transfer to Idle State

Active State is
in this state, the BGP process attempts to establish a TCP connection with the neighbor
1 If the connection is successful, the BGP process clears the ConnectRetry timer, completes initialization, sends an Open Message to the neighbor and transfers to Open send State, the Hold timer is set to 4mins
2 If the ConnectRelay timer expires, it will return to Connect State and reset the ConnectRelay timer. It also initiates a TCP connection to the peer and continues to listen for connections from the peer.
3 If the neighbor attempts to contact an unknown IP establishes a TCP session, and the ConnectRelay timer is reset. The connection is rejected and stays in Active State
4. Any event (except the start event) will cause the state to turn to idle State and remain in Active State:

Open send State   
In this state, the Open Message has been sent. BGP waits for the Open Message from the neighbor.
When it receives an Open Message, if an error is found, it will send a Notification Message to the neighbor and transfer it to Idle State
2. If it receives There is no error in the Open Message, and a Keepalive Message will be sent to the neighbor and the Keepalive timer will be cleared. At this time, a shorter holdtime is negotiated. If holdtime = 0, the holdtime and keepalive timers are not started. IBGP or EBGP is selected according to the AS number , At the same time, the state is transferred to OpenConfirm State
3 If a TCP disconnect message is received, the BGP connection is disconnected locally, the ConnectRetry timer is reset, and the state is transferred to Active State

Open Confirm State
In this state waits for a BGP Keepalive Message the Message or the Notification 
. 1 If you receive a Keepalive Message, State proceeds to the Establish
2 If you receive a Notification Message, into the Idle State, and disconnect the TCP connection
3 If the hold timer Overtime, an error or stop event is detected, BGP will send a Notification Message to the neighbor and disconnect the connection to Idle State
Establish State In
this state, the connection between BGP peers has been fully established and
can exchange Update Message and Keepalive Message , Notification Message
If you receive Notification Message, transfer to Idle State and disconnect


 

Published 220 original articles · won praise 2 · Views 4463

Guess you like

Origin blog.csdn.net/qq_43207781/article/details/105480903