BGP Finite State Model
RFC 1771 defines what is called a "finite state model" which diagrams BGP's behavior at startup. The finite-state-machine is a description of what actions should be taken by the BGP software and when. There are six states in the model, and there are specific conditions under which each state will transition to the next during the process of establishing first a TCP connection, and then a BGP session. Each step indicates a different state in the BGP session. For the purpose of this discussion, a 'router' is any device running BGP.
From the OSI Model's perspective, BGP is simply a networking APPLICATION running over the Session layer and everything below it. Thus, an ESTABLISHED SESSION is required for BGP to begin exchanging routes.
NOTE: A BGP SESSION RELIES ON A FUNCTIONAL RELIABLE TRANSPORT CONNECTION! WITHOUT A WORKING TCP CONNECTION YOU CANNOT HAVE BGP! I state this repeatedly throughout this tutorial page because it is the single most common mistake new BGP administrators make when troubleshooting a BGP session.
IDLE
When a BGP speaking router is awaiting a session it sits in the IDLE state. It will not start a session until a start event occurs. Cisco classifies initial configuration or clearing of a BGP session as a start event and the system transitions to the connect state. Whenever a BGP session is shut down because of an error, it returns to the Idle state. NOTIFICATION messages used to signal connection errors return the router to this state.
CONNECT
Once the BGP software and it's environment have been initialized, an OPEN message is sent. The router has attempted to open a TCP connection between itself and another BGP speaking peer.
ACTIVE
The router has started the first phase of initializing a TCP three-way handshake to the remote router (peer). THIS STATE DOESN'T MEAN SQUAT FOLKS! "ACTIVE" IS NOT A WORKING BGP SESSION, NOR IS IT AN ACTIVE TCP SESSION!!! ACTIVE SIMPLY MEANS THE ROUTER IS BUSY. If a router fails to establish a TCP connection, it drops back to IDLE.
OPEN SENT
Once BGP has performed all the setup steps necessary, it sends out a TCP SYN on port 170.
OPEN CONFIRM
The router enters this state after the remote router has sent back a TCP SYN packet indicating that the TCP session is being SYNchronized.
ESTABLISHED
After each router has sent an ACKnowledge, one router has sent a SYN, and a TCP handshake has been completed, the router attempts to exchange BGP messages.. If the router is in the OPEN CONFIRM state (the TCP Handshake is complete) and receives an UPDATE or KEEPALIVE message, the BGP session state changes to ESTABLISHED.
ESTABLISHED IS THE ONLY STATE THAT COUNTS FOLKS! This is the ONLY state in which BGP will actually exchange routes. Established is the ONLY state that counts. If you have any other state, you have a non-functional BGP session (and possibly a broken physical link if it refuses to establish the connection). On a Cisco router, you CANNOT have an ESTABLISHED BGP session if the interface is Line Protocol Up/Network Protocol Down.