Вы находитесь на странице: 1из 8

8/8/2016 BGP Neighbor Adjacency States | NetworkLessons.



Table of Contents

Unit 1: Introduction to BGP

Unit 2: BGP Neighbor Adjacency
BGP Neighbor Adjacency States

BGP Messages

Troubleshooting BGP Neighbor Adjacency

Troubleshooting BGP Route Advertisement

Unit 3: BGP Attributes

Unit 4: BGP Communities
Unit 5: BGP Filtering
Unit 6: Advanced BGP Features

You are here: Home » BGP

BGP Neighbor Adjacency States

12 votes

https://networklessons.com/bgp/bgp­neighbor­adjacency­states/ 1/14
8/8/2016 BGP Neighbor Adjacency States | NetworkLessons.com

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 con굞䃾gured manually and BGP uses TCP port 179 for the connection.

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

1. Idle:This is the 굞䃾rst state where BGP waits for a “start event”. The start event occurs when
someone con굞䃾gures 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.
2. 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.
3. 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).
4. 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 Noti굞䃾cation 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 noti굞䃾cation 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.
5. OpenCon굞䃾rm: 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

https://networklessons.com/bgp/bgp­neighbor­adjacency­states/ 2/14
8/8/2016 BGP Neighbor Adjacency States | NetworkLessons.com

completed. When this occurs, it will reset the hold timer. If we receive a noti굞䃾cation message
from the remote BGP neighbor then we fall back to the Idle state. BGP will keep sending
keepalive messages.
6. 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 noti굞䃾cation 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 oᄎcial name of a “diagram” that shows the di样냏erent 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 di样냏erent 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:

https://networklessons.com/bgp/bgp­neighbor­adjacency­states/ 3/14
8/8/2016 BGP Neighbor Adjacency States | NetworkLessons.com

Just two routers in two di样냏erent autonomous systems. Before I con굞䃾gure BGP, let’s enable a

R1, R2 #debug ip bgp 
BGP debugging is on for address family: IPv4 Unicast

This will give us everything...

R1(config)#router bgp 1 
R1(config‐router)#neighbor remote‐as 2

As soon as I do this you will see some debugging;

BGP: active went from Idle to Active 
BGP: open active, local address 
BGP: open failed: Connection refused by remote host 
BGP: Active open failed ‐ tcb is not available, open active delayed 
9216ms (35000ms max, 60% jitter) 
BGP: ses global (0x4B43F3FC:0) act Reset (Active open failed). 
BGP: active went from Active to Idle 
BGP: nbr global Active open failed ‐ open timer running

https://networklessons.com/bgp/bgp­neighbor­adjacency­states/ 4/14
8/8/2016 BGP Neighbor Adjacency States | NetworkLessons.com

As soon as I con굞䃾gure BGP on R1 it will try to connect to R2. You can see the debug says that the
state moves from Idle to Active (it doesn't show the Connect state in the debug). When it fails, it
falls back to the Idle state. Now let's con굞䃾gure BGP on R2 as well so we can see a successful
progress through the states:

R2(config)#router bgp 2 
R2(config‐router)#neighbor remote‐as 1

Now look at the debug on R1:

BGP: active went from Idle to Active 
BGP: open active, local address 
BGP: ses global (0x4B43F3FC:0) act Adding topology IPv4 Unicast:base
BGP: ses global (0x4B43F3FC:0) act Send OPEN 
BGP: active went from Active to OpenSent 
BGP: active sending OPEN, version 4, my as: 1, holdtime 180 seconds, 
ID C0A80C01 
BGP: active rcv message type 1, length (excl. header) 34 
BGP: ses global (0x4B43F3FC:0) act Receive OPEN 
BGP: active rcv OPEN, version 4, holdtime 180 seconds 
BGP: active rcv OPEN w/ OPTION parameter len: 24 
BGP: active rcvd OPEN w/ optional parameter type 2 (Capability) len 

BGP: active OPEN has CAPABILITY code: 1, length 4 
BGP: active OPEN has MP_EXT CAP for afi/safi: 1/1 
BGP: active rcvd OPEN w/ optional parameter type 2 (Capability) len 

BGP: active OPEN has CAPABILITY code: 128, length 0 
BGP: active OPEN has ROUTE‐REFRESH capability(old) for all address‐
BGP: active rcvd OPEN w/ optional parameter type 2 (Capability) len 

BGP: active OPEN has CAPABILITY code: 2, length 0 
BGP: active OPEN has ROUTE‐REFRESH capability(new) for all address‐

https://networklessons.com/bgp/bgp­neighbor­adjacency­states/ 5/14
8/8/2016 BGP Neighbor Adjacency States | NetworkLessons.com

BGP: active rcvd OPEN w/ optional parameter type 2 (Capability) len 

BGP: active OPEN has CAPABILITY code: 65, length 4 
BGP: active OPEN has 4‐byte ASN CAP for: 2 
BGP: nbr global neighbor does not have IPv4 MDT topology activated 
BGP: active rcvd OPEN w/ remote AS 2, 4‐byte remote AS 2 
BGP: active went from OpenSent to OpenConfirm 
BGP: active went from OpenConfirm to Established 
BGP: ses global (0x4B43F3FC:1) act Assigned ID 
BGP: ses global (0x4B43F3FC:1) Up 
%BGP‐5‐ADJCHANGE: neighbor Up

Above you can see that the BGP state moves from Idle to Active and then to OpenSent. Some Open
messages are sent and received, the BGP routers are exchanging some of their capabilities. From
there we move to the OpenCon굞䃾rm and Established state. Finally you see the BGP neighbor as up.
On R2 we see something similar:

BGP: passive open to 
BGP: passive went from Idle to Connect 
BGP: ses global (0x4B269374:0) pas Setting open delay timer to 60 
BGP: ses global (0x4B269374:0) pas read request no‐op 
BGP: passive rcv message type 1, length (excl. header) 34 
BGP: ses global (0x4B269374:0) pas Receive OPEN 
BGP: passive rcv OPEN, version 4, holdtime 180 seconds 
BGP: passive rcv OPEN w/ OPTION parameter len: 24 
BGP: passive rcvd OPEN w/ optional parameter type 2 (Capability) len 

BGP: passive OPEN has CAPABILITY code: 1, length 4 
BGP: passive OPEN has MP_EXT CAP for afi/safi: 1/1 
BGP: passive rcvd OPEN w/ optional parameter type 2 (Capability) len 

BGP: passive OPEN has CAPABILITY code: 128, length 0 
BGP: passive OPEN has ROUTE‐REFRESH capability(old) for all address‐

https://networklessons.com/bgp/bgp­neighbor­adjacency­states/ 6/14
8/8/2016 BGP Neighbor Adjacency States | NetworkLessons.com

BGP: passive rcvd OPEN w/ optional parameter type 2 (Capability) len 

BGP: passive OPEN has CAPABILITY code: 2, length 0 
BGP: passive OPEN has ROUTE‐REFRESH capability(new) for all address‐
BGP: passive rcvd OPEN w/ optional parameter type 2 (Capability) len 

BGP: passive OPEN has CAPABILITY code: 65, length 4 
BGP: passive OPEN has 4‐byte ASN CAP for: 1 
BGP: nbr global neighbor does not have IPv4 MDT topology activated 
BGP: passive rcvd OPEN w/ remote AS 1, 4‐byte remote AS 1 
BGP: ses global (0x4B269374:0) pas Adding topology IPv4 Unicast:base
BGP: ses global (0x4B269374:0) pas Send OPEN 
BGP: passive went from Connect to OpenSent 
BGP: passive sending OPEN, version 4, my as: 2, holdtime 180 
seconds, ID C0A80C02 
BGP: passive went from OpenSent to OpenConfirm 
BGP: passive went from OpenConfirm to Established 
BGP: ses global (0x4B269374:1) pas Assigned ID 
BGP: nbr global Stop Active Open timer as all topologies are 
BGP: ses global (0x4B269374:1) Up 
%BGP‐5‐ADJCHANGE: neighbor Up

The output of these debug messages are nice and easy to read. If for some reason your neighbor
adjacency doesn't appear, these debugs can be helpful to solve the problem.


Want to take a look for yourself? Here you will 굞䃾nd the con굞䃾guration of each device.

hostname R1 

interface fastEthernet0/0 

https://networklessons.com/bgp/bgp­neighbor­adjacency­states/ 7/14
8/8/2016 BGP Neighbor Adjacency States | NetworkLessons.com

 ip address 

router bgp 1 
 neighbor remote‐as 2 


hostname R2 

interface fastEthernet0/0 
 ip address 

router bgp 2 
 neighbor remote‐as 1 


I hope this has been useful to you to understand the di样냏erent BGP states. If you have any
questions, feel free to leave a comment!

Rate this Lesson:

« Previous Lesson
BGP Auto-summary
Next Lesson
BGP Messages »
https://networklessons.com/bgp/bgp­neighbor­adjacency­states/ 8/14