BGP Neighbor Adjacency States

Just like OSPF or EIGRP, BGP establishes a neighbor adjacency with other BGP routers before they exchange any routing information. Unlike other routing protocols however, BGP does not use broadcast or multicast to “discover” other BGP neighbors.

Neighbors have to be configured manually and BGP uses TCP port 179 for the connection.

In this lesson we’ll take a close look at the different “states” when two BGP routers try to become neighbors. Here they are:

Idle:This is the first state where BGP waits for a “start event”. The start event occurs when someone configures a new BGP neighbor or when we reset an established BGP peering. After the start event, BGP will initialize some resources, resets a ConnectRetry timer and initiates a TCP connection to the remote BGP neighbor. It will also start listening for a connection in case the remote BGP neighbor tries to establish a connection. When successful, BGP moves to the Connect state. When it fails, it will remain in the Idle state.

Connect: BGP is waiting for the TCP three-way handshake to complete. When it is successful, it will continue to the OpenSent state. In case it fails, we continue to the Active state. If the ConnectRetry timer expires then we will remain in this state. The ConnectRetry timer will be reset and BGP will try a new TCP three-way handshake. If anything else happens (for example resetting BGP) then we move back to the Idle state.

Active: BGP will try another TCP three-way handshake to establish a connection with the remote BGP neighbor. If it is successful, it will move to the OpenSent state. If the ConnectRetry timer expires then we move back to the Connect state. BGP will also keep listening for incoming connections in case the remote BGP neighbor tries to establish a connection. Other events can cause the router to go back to the Idle state (resetting BGP for example).

OpenSent: In this state BGP will be waiting for an Open message from the remote BGP neighbor. The Open message will be checked for errors, if something is wrong (incorrect version numbers, wrong AS number, etc.) then BGP will respond with a Notification message and jumps back to the Idle state. This is also the moment where BGP decides whether we use EBGP or IBGP (since we check the AS number). If everything is OK then BGP starts sending keepalive messages and resets its keepalive timer. At this moment, the hold time is negotiated (lowest value is picked) between the two BGP routers. In case the TCP session fails, BGP will jump back to the Active state. When any other errors occur (expiration of hold timer), BGP will send a notification message with the error code and jumps back to the Idle state. In case someone resets the BGP process, we also jump back to the Idle state.

OpenConfirm: BGP waits for a keepalive message from the remote BGP neighbor. When we receive the keepalive, we can move to the established state and the neighbor adjacency will be completed. When this occurs, it will reset the hold timer. If we receive a notification message from the remote BGP neighbor then we fall back to the Idle state. BGP will keep sending keepalive messages.

Established: The BGP neighbor adjacency is complete and the BGP routers will send update packets to exchange routing information. Every time we receive a keepalive or update message, the hold timer will be resetted. In case we receive a notification message we will jump back to the Idle state.

This whole process of becoming BGP neighbors can be visualized, this might be a bit easier then just reading about it. The official name of a “diagram” that shows the different states and we can move from one state to another is called a FSM (Finite State Machine). For BGP, it looks like this:

Now you know about the different states, let’s take a look at some Cisco BGP routers to see what it actually looks like on two routers. I’ll use the following topology for this:

Just two routers in two different autonomous systems. Before I configure BGP, let’s enable a debug:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.

Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!

Hei Rene,
Thanks for the lesson, in my working experience, i am stuck in a situation for 2 sites. i have the ebgp peering up, but i am receiving 0 prefix from my isp. The isp said when they show ip bgp nei adverticed route that are hundreds of routes advertised, they can receive our route. Any good debug command to troule should this? We have plain bgp config, the same config (different peering ip though) is working with other sites.

One interesting thing is that when i ping the isp with mtu 1500 it does not work, but it works with 1496. After reading cisco doc

The segment size is 1460 bytes, add a TCP header (20 bytes) and IP header (20 bytes) and you have a 1500 byte packet. In other words, you should be able to send/receive up to 1500 bytes which is not possible at the moment.

I bought this book called Routing TCP/IP, Volume II: CCIE Professional Development 2
Great book but they have very complex descriptions on some things let me show you their chart lol… your chart below nocked it out of the ball park. don’t get me wrong that’s a great book but its hard as hex to understand and works better when paired with something like your website which can break it down in simple terms. I just had to laugh over the two diagrams though as yours was so easy to understand lol…

It is possible to apply load balancing in BGP. BGP will not perform Equal Cost Multi-Path (ECMP) routing by default but it can be configured to do so. Specifically, you can use BGP multipath load sharing. You can see how to configure eBGP and iBGP to use more than one path in the following lesson:

New Lessons

Testimonials

Highly Recommended

The lessons are well structured, easy to understand, clear and very thorough. I appreciate the diagrams (pictures work great for me) and the example configs. It's very easy to copy the provided configurations into your home lab and play with the exact scenarios they explain to you. I would recommend NetworkLessons.com to anyone. I went for the yearly membership and only had it for 2 months and feel it had already paid off!

Dan MassaNetwork EngineerApril 20, 2018

Easy to Follow

NetworkLessons.com is very organized in its lessons and courses, simple and easy to follow. It's almost addictive!

Subrata SenRyerson UniversitySeptember 5, 2017

Clear and Detailed Lessons

I really enjoy learning about routing protocols. Rene breaks down each routing technology, and explains how to troubleshoot them. He builds small topologies that allow you to learn and implement. As a CCIE candidate, NetworkLessons.com has been a huge help towards me preparing for my CCIE R&S Certification, as well as reaffirming technologies learned in my CCNA/CCNP studies. I would highly recommend NetworkLessons.com to anyone looking to further their understanding of network technologies.

Jeffrey DealSenior Network EngineerJuly 15, 2016

Best Learning Site Ever

Lessons are precise, accurate, thorough and complete. And are written to be understood by everyone at every level. Can't say thank you enough for helping me learn so fast! It would take 10 times longer if I learn from other sources. Many Thanks!

Hoan NguyenNetwork EngineerDecember 15, 2016

Really Helped Getting my CCIE

The lessons and explanations of NetworkLessons.com are presented in a very simple way that its easier to absorb than other sources and to get the hang of it. NetworkLessons.com has really helped me with my CCIE certification. Thanks!

Darmah RajSenior Network EngineerJuly 16, 2018

Excellent E-Learning Cisco

I am a very content member! First I have been studying for two years by reading too many books but I could not make any serious progress on my certifications. Until I found out about NetworkLessons.com. I can recommend everyone to become a member. Believe it, you will not regret it! It's a great online training portal for Cisco exams.

Bahri AygördüITJuly 26, 2018

Well Worth It

Rene is quite simply great at what he does. My process for learning Cisco (and networking in general) is to get an introduction to concepts or processes first, and then once I have a general idea of what's what, then to go to NetworkLessons.com to actually understand the hands-on configuration and mechanics involved. So far it's a system that just can't be beaten and I would recommend it to anyone seeking to broaden their networking knowledge and skills. Thank you!

Rey GaljourIT Systems ManagerNovember 20, 2018

Passed my CCNA

The lessons are very well explained in simple terms. I passed my CCNA from studying from this site! The videos are very educative. NetworkLessons.com is a great e-learning site which explains simplified and precise.

Lamin J. CeesayTechnicianAugust 1, 2017

Piece of Art!

I recommend starting your networking career with NetworkLessons.com. It gives basic and advanced knowledge in all networking and security topics. A great tool to gain, upgrade or refresh your knowledge. Next to being outstanding and straightforward, it's utterly affordable and a great, reliable source of information.

Tatyana KostovaNetwork EngineerJune 30, 2016

Amazing!

NetworkLessons.com has become an invaluable resource for me. Of course, the official Cisco press books are just fine and cover all the material in thorough detail. The difference though is that Rene emphasizes the important topics that you really need to know in a real production environment. He gives you the meat and potatoes and does so in a way that's very easy to understand. My favorite thing about NetworkLessons.com is that I can use it as a quick reference when I am troubleshooting on the job. This is much better than lugging around official Cisco press books and sifting through pages and pages to find something specific I'm looking for.

Leroy MerinoNetwork EngineerJune 26, 2017

I Only Wish I Knew Before…

I am very impressed with the way difficult networking concepts are easily explained by Rene in his lessons. I have no doubt in saying that signing up for membership was the best investment I have spent on learning networking. I only wish I would have started reading NetworkLessons.com long before!

Dave AbhishekNetwork ConsultingAugust 23, 2016

Pedagogy & Deep Understanding of Networking

I’ve fallen in love with Rene’s materials. I was looking for an online course to start my CCNP R&S. Then I went like: Who's better than this guy playing that easy with networking principles and Cisco devices and who truly knows the art of teaching networking? I’m enjoying so far all valuable content of NetworkLessons.com and above all, Rene’s teachings are helping me to move smoothly on my journey towards my CCNP R&S certification. Rene in an expert in pedagogy and I recommend his courses to everyone who want to go deep with networking principles.