Networks Training

  • About
  • My Books
  • SUGGESTED TRAINING
  • HOME
  • Cisco Networking
    • Cisco General
    • Cisco IOS
    • Cisco VPN
    • Cisco Wireless
  • Cisco ASA
    • Cisco ASA General
    • Cisco ASA Firewall Configuration
  • Certifications Training
    • CCNA Training
    • Cisco Certifications
    • I.T Training
  • General
    • General Networking
    • IP Telephony
    • Network Security
    • Product Reviews
    • Software
  • Cisco Routers
  • Cisco Switches
You are here: Home / Cisco Routers / Explanation of BGP Neighbor Adjacency States on Cisco Devices

Explanation of BGP Neighbor Adjacency States on Cisco Devices

Written By Lazaros Agapidis

Border Gateway Protocol (BGP) is the fundamental routing protocol that is used on the Internet.  Like most routing protocols, BGP depends upon the creation of neighbor adjacencies between BGP routers to exchange prefixes and routing information. 

bgp protocol states

In order to successfully create these neighbor adjacencies, they go through a series of neighbor adjacency states. 

In this article, we’ll describe the BGP states and the process through which BGP routers go to become neighbors and begin exchanging routing information.

Table of Contents

  • Fundamentals of BGP Neighbor Adjacencies
  • BGP peering
  • Finite State Machine (FSM)
  • BGP’s FSM
  • BGP neighbor adjacency states of the FSM
  • Idle State
  • Connect State
  • Active State
  • OpenSent State
  • OpenConfirm State
  • Established State
  • Summary Table of BGP FSM States
  • Value of Understanding the BGP States
  • Conclusion

Fundamentals of BGP Neighbor Adjacencies

BGP is known as a path-vector routing protocol, which is somewhat different from the more conventional link-state or distance-vector routing protocols. 

As such, it is unique in some of the ways it operates as well as in the associated terminology that is used.

BGP peering

Unlike other routing protocols, such as EIGRP or OSPF, BGP neighbors can only be created manually using the neighbor command. 

BGP peers, once configured, begin communicating over a TCP session that uses port 179.  A BGP neighbor adjacency is often called a BGP peering, and the routers involved in that peering are referred to as BGP peers.

Finite State Machine (FSM)

Once the neighbor command is manually configured on a BGP router, the process of establishing the two devices as BGP peers begins. 

This process goes through the various neighbor adjacency states that we will talk about shortly to achieve a successful BGP peering. 

This process of going from state to state, and the rules that govern it, are called the BGP Finite State Machine or FSM.

An FSM is not exclusive to BGP.  In its broader definition, it defines a mathematical model of computation. 

It’s an abstract “machine” or computational entity that can be in exactly one of a finite number of states at any given time. 

An FSM can change from one state to another in response to some inputs or events.  An FSM is defined by a list of its states, its initial state, and the conditions for each transition from one state to the next.

FSMs are used by routing protocols including OSPF and EIGRP to create and manage neighbor relationships.  Of course, BGP also uses an FSM for this purpose.

BGP’s FSM

This explanation will become clearer when we look at a visual representation of BGP’s FSM, which depicts all of the states that the machine goes through to achieve a successful BGP peering:

MORE READING:  10 Different Types of IP Addresses Used in Computer Networks

bgp finite state machine diagram

Once the TCP session between BGP peers has been established, the BGP FSM begins in the Idle state.  It must then go through the various neighbor adjacency states to reach the Established state, which is the condition under which BGP routers have successfully become neighbors or peers. 

There are specific rules that govern the process for success, and these are discussed in the following sections.

BGP neighbor adjacency states of the FSM

Below we delve further into the different stages or “states” that two BGP routers pass through in their attempt to establish neighborship or a BGP peering. 

These stages include references to additional variables and components such as the ConnectRetry timer, KeepAlive timer, hold time timer, as well as open, update, keepalive, and notification BGP messages to name a few.  Let’s take a look at each state in detail:

Idle State

This is the initial state, where BGP anticipates a “start event.” This event triggers when a new BGP neighbor is configured or an established BGP peering is reset. 

Following this event, BGP initializes some resources, resets the ConnectRetry timer, and attempts to create a TCP connection with the remote BGP neighbor. 

Additionally, it begins listening for a connection if the remote BGP neighbor initiates one.  If successful, BGP transitions to the Connect state.  If not, it stays in the Idle state.

Connect State

In this state, BGP awaits the completion of the TCP three-way handshake.  If successful, it proceeds to the OpenSent state.  If it fails, the state changes to Active. 

Should the ConnectRetry timer expire, it remains in the Connect state, resetting the timer and attempting a new TCP three-way handshake.  If any other event occurs (like the resetting BGP), it reverts to the Idle state.

Active State

Here, BGP attempts another TCP three-way handshake with the remote BGP neighbor.  If successful, it transitions to the OpenSent state. 

If the ConnectRetry timer expires, it reverts to the Connect state.  During this state, BGP also remains alert for incoming connections from the remote BGP neighbor.  Certain events can cause it to return to the Idle state (such as resetting BGP).

OpenSent State

In this phase, BGP expects an open message from the remote BGP neighbor.  This message is examined for errors. 

If discrepancies like incorrect version numbers, wrong AS numbers, or other issues are found, BGP responds with a notification message and returns to the Idle state. 

Here, BGP also determines if it will use eBGP or iBGP based on the AS number check.  If all is in order, BGP commences sending keepalive messages and resets its KeepAlive timer. 

MORE READING:  Difference Between LAN and WAN Networks - Compared and Explained

The hold time is negotiated (the lowest value is selected) between the two BGP routers.  If the TCP session fails, BGP reverts to the Active state. 

Other events, like the hold timer’s expiration, prompt BGP to send a notification message with the error code and return to the Idle state.  If the BGP process is reset, it also returns to the Idle state.

OpenConfirm State

In this state, BGP waits for a keepalive message from the remote BGP neighbor.  Once the keepalive message is received, it moves to the Established state, completing the neighbor adjacency. 

This event resets the hold timer.  If a notification message is received from the remote BGP neighbor, it falls back to the Idle state.  BGP continues to send keepalive messages.

Established State

At this point, the BGP neighbor adjacency is finalized and the BGP routers exchange routing information via update packets. 

Each time a keepalive or update message is received, the hold timer is reset.  If a notification message is received, it reverts to the Idle state.

Summary Table of BGP FSM States

State Description Next Possible State(s)
Idle The initial state.  BGP waits for a start event and attempts to initiate a TCP connection. Connect
Connect BGP awaits the completion of a TCP three-way handshake. Active, OpenSent, or Idle
Active BGP attempts another TCP three-way handshake to establish a connection. Connect, OpenSent, or Idle
OpenSent BGP waits for an Open message from the neighbor and checks it for errors. OpenConfirm, Active, or Idle
OpenConfirm BGP waits for a keepalive message from the neighbor to confirm the connection. Established or Idle
Established The final state, where BGP neighbor adjacency is complete and routers exchange routing updates. Idle

Value of Understanding the BGP States

In cases where a BGP peering fails, or is intermittent, a series of troubleshooting tasks must be performed in order to determine the problem. 

Understanding the BGP FSM and its states is a fundamental part of being able to successfully troubleshoot, debug, and diagnose such problems. 

The above explanation is a relatively high-level description of the FSM states, and doesn’t include all possible events and contingencies, but it gives an excellent introduction to the process. 

For a complete and authoritative description of the BGP FSM in all its detail, take a look at the FSM section of RFC 4271.

Conclusion

Understanding the various stages of the BGP FSM is fundamental to comprehending the dynamics of neighbor relationships in networking. 

The stages summarize the comprehensive process of establishing a connection, maintaining it, and handling various events, such as error occurrences or session failures. 

These states enable BGP to manage its resources and communications effectively, ensuring the robustness and resilience of the network. 

Comprehending these states is imperative for any self-respecting network engineer, not only because it provides an insight into the inner workings of BGP but also because it equips professionals to troubleshoot and optimize network performance effectively.

Related Posts

  • Discussion and Explanation of OSPF Graceful Restart and Shutdown
  • Explanation and Configuration of OSPF MD5 Authentication on Cisco Networks
  • Comparison of Static vs Dynamic Routing in TCP/IP Networks
  • How to Configure Static Routing on Cisco IOS Routers (Examples)
  • Comparison of BGP Confederations vs Route Reflectors

Filed Under: Cisco Routers, General Networking

Download Free Cisco Commands Cheat Sheets

Enter your Email below to Download our Free Cisco Commands Cheat Sheets for Routers, Switches and ASA Firewalls.

We use Elastic Email as our marketing automation service. By submitting this form, you agree that the information you provide will be transferred to Elastic Email for processing in accordance with their Terms of Use and Privacy Policy. Also, you allow me to send you informational and marketing emails from time-to-time.

About Lazaros Agapidis

Lazaros Agapidis is a Telecommunications and Networking Specialist with over twenty years of experience.
He works primarily with IP networks, VoIP, Wi-Fi, and 5G, has extensive experience in training professionals for Cisco certifications, and his expertise extends into telecommunications services and infrastructure from both an enterprise and a service provider perspective.
In addition to his numerous vendor certifications, Lazaros has a solid online presence as an expert in his field, having worked in both public and private sectors within North America and in Europe.
He has enjoyed sharing his practical experiences in writing as well as through engaging online training.
LinkedIn: Lazaros Agapides

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search this site

About Networks Training

We Provide Technical Tutorials and Configuration Examples about TCP/IP Networks with focus on Cisco Products and Technologies. This blog entails my own thoughts and ideas, which may not represent the thoughts of Cisco Systems Inc. This blog is NOT affiliated or endorsed by Cisco Systems Inc. All product names, logos and artwork are copyrights/trademarks of their respective owners.

Amazon Disclosure

As an Amazon Associate I earn from qualifying purchases.
Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.

Search

BLOGROLL

Tech21Century
Firewall.cx

Copyright © 2023 | Privacy Policy | Terms and Conditions | Hire Me | Contact | Amazon Disclaimer | Delivery Policy

0 shares