PacketLab
BGP · Neighbor Adjacency

BGP Neighbor Adjacency States

Read the session state before changing the configuration. Each state tells you how far TCP and the BGP handshake have progressed.

The six states

Idle

The session is not running. A start event prepares its resources and connection retry timer. Administrative shutdown can keep a neighbor here; Idle by itself does not identify the cause.

Connect

BGP is waiting for a TCP connection. Success normally leads to OpenSent. A retry timer can restart the attempt. In the base RFC state machine, TCP failure returns to Idle unless optional DelayOpen behavior selects Active.

Active

The speaker is trying to obtain a TCP connection and listening for an incoming one. A successful connection normally leads to OpenSent; retry expiry leads back to Connect. Active does not mean the BGP session is working.

OpenSent

TCP is available and the local OPEN has been sent. The received OPEN must pass version, peer-AS and other checks. A valid OPEN leads to OpenConfirm; TCP failure here leads to Active. An OPEN error resets the session.

OpenConfirm

The OPEN exchange has succeeded. BGP waits for the peer’s KEEPALIVE. Receiving it completes establishment; a hold expiry, notification or TCP failure resets the session.

Established

The session can exchange UPDATEs. Valid KEEPALIVEs and UPDATEs refresh a nonzero hold timer. A TCP loss or hold expiry returns this session to Idle and removes its ordinary learned paths; graceful-restart retention is a separate feature.

State transition diagram

  • Solid green: normal progress.
  • Amber dash-dot: retry or transport loss.
  • Gray dashed: reset to Idle.
  • Curved loop: handle an event without changing state.
  • Green state: Established, where routes can be exchanged.
  • Amber state: Active, still acquiring a connection.
BGP state transitionsNormal progress left to right
NOTIFICATION sent, hold timer expires or ManualStop · plus TCP lost in OpenConfirm / Established TCP fails² ConnectRetryexpires Start TCP up /send OPEN OPEN valid /send KEEPALIVE KEEPALIVE ConnectRetryexpires TCP fails¹ TCP up /send OPEN TCP lost TCP fails / ManualStop KEEPALIVE / UPDATErestarts hold timer IdleConnectOpenSentOpenConfirmEstablishedActive
Principal session transitions. ¹ TCP failure in Connect goes to Active while the optional DelayOpen timer runs; ² without that timer, it returns to Idle. TCP loss in OpenSent goes to Active; TCP loss in OpenConfirm or Established resets to Idle. The Established loop refreshes a nonzero hold timer. Optional collision handling is omitted. Scroll horizontally if needed to read all labels.

Configure the peers

Use two directly connected routers, with no originated prefixes. Both sides explicitly use 30-second keepalives and a 90-second proposed hold time.

R1–R2 · directly connected eBGPIllustrative topology
AS 65010AS 65020192.0.2.0/30Gi1 · .1Gi1 · .2R1Lo0: 10.255.0.1/32R2Lo0: 10.255.0.2/32
Solid line: physical link. Interface addresses are also BGP session endpoints. Loopback0 supplies a fixed router ID; it is not the transport source.
Complete baseline configurations

R1

hostname R1
ip cef
interface Loopback0
 ip address 10.255.0.1 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.1 255.255.255.252
 no shutdown
exit
router bgp 65010
 bgp router-id 10.255.0.1
 bgp log-neighbor-changes
 timers bgp 30 90
 no bgp default ipv4-unicast
 neighbor 192.0.2.2 remote-as 65020
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.2 activate
 exit-address-family
end

R2

hostname R2
ip cef
interface Loopback0
 ip address 10.255.0.2 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.2 255.255.255.252
 no shutdown
exit
router bgp 65020
 bgp router-id 10.255.0.2
 bgp log-neighbor-changes
 timers bgp 30 90
 no bgp default ipv4-unicast
 neighbor 192.0.2.1 remote-as 65010
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.1 activate
 exit-address-family
end
Outputs and packet decodes are illustrative, not recorded lab results. Keepalive/hold settings in these labs are explicitly 30/90 seconds. Reset each independent fault scenario to its stated baseline before testing.

Observe the session

R1# show ip bgp neighbors 192.0.2.2 | include BGP state|hold time
  BGP state = Established, up for 00:02:00
  Last read 00:00:10, last write 00:00:10, hold time is 90, keepalive interval is 30 seconds
R1# show ip bgp summary
BGP router identifier 10.255.0.1, local AS number 65010
Neighbor        V     AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down  State/PfxRcd
192.0.2.2       4  65020      12      12      1   0    0 00:02:00 0

A number in State/PfxRcd means Established in this summary format. Zero means no accepted prefixes, not a failed handshake. Connect, OpenSent and OpenConfirm can pass too quickly to catch in a single poll.

Short lab-only debug example
R1# debug ip bgp
BGP debugging is on for address family: IPv4 Unicast
BGP: 192.0.2.2 went from Connect to OpenSent
BGP: 192.0.2.2 went from OpenSent to OpenConfirm
BGP: 192.0.2.2 went from OpenConfirm to Established

R1# undebug all
All possible debugging has been turned off

The excerpt illustrates transitions; it does not imply that a debug command itself resets or establishes the session. Keep debugging brief in a lab.

Follow a reset

In this lab, disabling R2’s physical interface breaks the live TCP session.

interface GigabitEthernet1
 shutdown
R1# show ip bgp summary
BGP router identifier 10.255.0.1, local AS number 65010
Neighbor        V     AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down  State/PfxRcd
192.0.2.2       4  65020       0       0      1   0    0 never    Active

Immediately after detecting the failure, an Established session returns to Idle. An automatic restart can already have moved it into Connect or Active by the time the summary is read. Diagnose the last reset reason as well as the current state.

R1# show ip bgp neighbors 192.0.2.2 | include Last reset
  Last reset 00:00:12, due to Interface flap

Restore R2’s interface, then verify that the handshake completes again.

interface GigabitEthernet1
 no shutdown
R1# show ip bgp summary
BGP router identifier 10.255.0.1, local AS number 65010
Neighbor        V     AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down  State/PfxRcd
192.0.2.2       4  65020      12      12      1   0    0 00:02:00 0

Key Takeaways

  • Idle, Connect, Active, OpenSent, OpenConfirm and Established describe different session stages.
  • Active means a connection is still being sought; it does not mean the BGP session is operational.
  • A valid OPEN leads to OpenConfirm; receiving KEEPALIVE there leads to Established.
  • TCP failure in OpenSent returns to Active; TCP failure in Established resets the session to Idle before a restart.
  • A numeric State/PfxRcd value indicates an Established session in the example summary output, even when that number is zero.

Adjacency States Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. Which state allows ordinary route UPDATE exchange?
2. What does Active in the summary mean?
3. What moves OpenConfirm to Established?
4. Where does a TCP failure take an OpenSent session in the base FSM?
5. State/PfxRcd shows 0 instead of a state name. What does that mean here?
6. Why might a failed Established session already show Active when you inspect it?
Protocol and command references

BGP protocol and finite state machine · Router-symbol attribution.