Solution |
BGP establishes a TCP connection with peers or adjacent routers. The Finite State Machine (FSM) is used by BGP to keep track of all BGP neighbors and the operational condition. The following states are possible for the BGP session to report:
BGP States
- Idle: This is the initial state of BGP. In this state, when a start event occurs (like configuring a new neighbor) the BGP resources will be initiated, the ConnectRetry timer will be reset, and a TCP connection will be initiated to the neighbor.In this state, BGP is also listening in case the remote peer tries to establish a connection. When successful, it moves to the connect state.
For eBGP neighbors that are not directly connected, ensure eBGP MultiHop to allow BGP packets to traverse the entire path to reach the destination, as there may not be any BGP messages visible after the three-way handshakes, which will keep the relationship in the idle state.
If an error occurs the BGP process will transition to Idle state. From there the router will set a Connect timer, where it will not try to establish a BGP relationship with the declared offline member until the timer expires. Default Connect Timer FOS value 120.
- Connect: In this state, BGP initiates the TCP connection. The device initiating the request uses a dynamic source port, but the destination port is always 179.
When the connection is successful an Open message is sent to the neighbor and it moves to the Open Sent state. When it fails it moves to the Active state or connect state.
- Active: The BGP process will try to establish another TCP connection with the neighbor. In this state, a TCP connection is initiated remote peer. When the connection is successful it will move to the Open Sent state. When it fails it moves to Connect state or idle state. In this state, BGP is also listening in case the remote peer will try to establish a connection. Once the negotiated time out, still, if it fails then go back to connect or idle state based on the failure reason.
- Open Sent: In this state, BGP is waiting for an Open message from the remote neighbor.
When an Open message is received, BGP will check parameters and it will be checked for errors. If there are no errors, BGP will start sending keepalive messages and move to the Open Confirm state.
When it is sending a keepalive, it is set to hold on time, then moved to open confirm. In this state, the Hold timer is negotiated, and whether EBGP or IBGP will be used. In case there is an error in the received Open message, a Notification message is sent to the neighbor and it moves to the Idle state.
- Open Confirm: In this state, BGP is waiting for a Keepalive message from the neighbor.
When a keep-alive message is received, it moves to the Established state, but if a Notification message is received, it moves to the Idle state.
- Established: In this state, the connection is fully established, and update messages with routing information are exchanged.
When a Keepalive or an Update message is received, the Hold timer will reset. If a Notification message is received, the connection will close and BGP will move to the Idle state.
|