BGP Neighbor States: How the Finite State Machine Works

BGP neighbor states and the BGP finite state machine: Idle, Connect, Active, OpenSent, OpenConfirm and Established

On the RouteViews collector at the University of Oregon, one BGP neighbor has been in the Active state for one year and 28 weeks, and another has sat in Active since early October with its log line reading Last reset 7w5d, due to Active open failed. Neither will ever send a route unless someone fixes the TCP connection under it. BGP neighbor states are usually the first thing an engineer checks, and they say a lot if you know what each one means. This is part 4 of our 26-part BGP Deep Dive. We go through the finite state machine (FSM) of RFC 4271 state by state, with its events, timers and error paths. Then we build a GoBGP 4.11 lab where five sessions fail in five different ways, and read the exact state changes, timers and NOTIFICATIONs from the logs.

TL;DR
  • Six states, one way up: Idle → Connect/Active → OpenSent → OpenConfirm → Established. Any error, NOTIFICATION or expired hold timer sends the session back to Idle.[1]
  • Active is not up. It means the router is still trying to get a TCP connection on port 179. Idle means it is not trying right now: shut down, over a prefix limit, or backing off after errors.[1][13]
  • Timers drive the FSM: ConnectRetry (RFC: 120 s), hold time (RFC: 90 s, negotiated down to the lower offer), keepalive (one third of the hold time), a 4-minute hold time in OpenSent, and optional IdleHold and DelayOpen timers.[1][2]
  • Lab results (GoBGP 4.11): a silent peer was dropped after exactly 240.0 s in OpenSent; a peer that stopped sending keepalives was dropped 6.0 s after its last one; after a Bad Peer AS error the Idle time doubled 2, 4, 8, 16, 32, 64 s.[16]
  • Implementations differ from the textbook. GoBGP has no visible Connect state and kept showing Active for 240 s while its own OPEN was unanswered. In our test it also never timed out a session stuck in OpenConfirm. Check what your platform does before you trust the state name.[8][16]

Why BGP neighbor states matter

BGP has no hello protocol and no neighbor discovery. A BGP speaker has a configured list of peers, opens a TCP connection to each of them and then runs one copy of the finite state machine per peer. RFC 4271 defines that machine in section 8: six states, 28 numbered events and a list of actions for every state and event pair.[1] The RFC also says the FSM is "conceptual": an implementation does not have to be built exactly like it, as long as its externally visible behaviour is the same.[1] Real routers therefore show slightly different state names and timers, and our lab shows a few of those differences.

When a session is down, the state tells you which layer to check first. Idle points at configuration, policy or a back-off timer. Connect and Active point at IP reachability and TCP port 179. OpenSent and OpenConfirm point at BGP itself: the OPEN parameters, the capabilities and the timers. Established that keeps flapping points at keepalives, hold timers and the transport under them. Our 2011 post BGP Neighbor States listed the six states in a few lines. This article covers the events, the timers, connection collisions, damping, vendor differences and real traces.

The BGP finite state machine at a glance

BGP finite state machine diagram with the six BGP neighbor states and RFC 4271 event numbers
Figure 1. The BGP finite state machine of RFC 4271 with the main transitions. Event numbers E1-E28 are the RFC numbers. Every state falls back to Idle on errors.

RFC 4271 gives each peer a set of mandatory session attributes: the State, a ConnectRetryCounter, the ConnectRetryTimer and its initial value ConnectRetryTime, the HoldTimer and HoldTime, and the KeepaliveTimer and KeepaliveTime.[1] Thirteen optional attributes add features that many routers already had when the RFC was written, among them PassiveTcpEstablishment, DelayOpen, DampPeerOscillations with an IdleHoldTimer, CollisionDetectEstablishedState and SendNOTIFICATIONwithoutOPEN.[1]

The 28 events fall into four groups:[1]

GroupEventsExamples
AdministrativeE1-E8E1 ManualStart, E2 ManualStop, E3 AutomaticStart, E4/E5 start with passive TCP, E6/E7 start with DampPeerOscillations, E8 AutomaticStop (for example a maximum-prefix limit)
TimerE9-E13E9 ConnectRetryTimer_Expires, E10 HoldTimer_Expires, E11 KeepaliveTimer_Expires, E12 DelayOpenTimer_Expires, E13 IdleHoldTimer_Expires
TCPE14-E18E14 TcpConnection_Valid, E15 Tcp_CR_Invalid, E16 Tcp_CR_Acked (our connection), E17 TcpConnectionConfirmed (their connection), E18 TcpConnectionFails
BGP messageE19-E28E19 BGPOpen, E20 BGPOpen with DelayOpenTimer running, E21 BGPHeaderErr, E22 BGPOpenMsgErr, E23 OpenCollisionDump, E24 NotifMsgVerErr, E25 NotifMsg, E26 KeepAliveMsg, E27 UpdateMsg, E28 UpdateMsgErr

RFC 9687 (2024) adds a 29th event, SendHoldTimer_Expires, which we cover with the timers below.[2]

The six BGP neighbor states one by one

Idle

Every peer starts in Idle. RFC 4271: "In this state, BGP FSM refuses all incoming BGP connections for this peer. No resources are allocated to the peer."[1] A ManualStart (E1) or AutomaticStart (E3) makes the router reset the ConnectRetryCounter, start the ConnectRetryTimer, open a TCP connection to the peer, listen for one from the peer, and move to Connect. A start with PassiveTcpEstablishment (E4/E5) only listens and moves straight to Active. Junos calls this option passive, IOS XE transport connection-mode passive, and IOS XR session-open-mode passive-only.[10][14]

All error paths end in Idle, so a router needs a rule for when to leave Idle again. Without one, a broken peer would be retried in a tight loop. RFC 4271 makes this optional: with DampPeerOscillations an implementation keeps the peer in Idle for an IdleHoldTime, and the RFC's example raises that time from 0 to 120 seconds if a peer flaps 10 times within 5 minutes.[1] RFC 4486 recommends the same damping after a Cease with subcode Administrative Shutdown, Peer De-configured, Connection Rejected or Out of Resources, and an upper bound on automatic retries.[3] FRR and GoBGP both start with 1 second and double it after every error, up to 120 seconds. The lab below shows that back-off.[8][9]

Cisco adds a reason to the summary output: Idle (Admin) for a neighbor that is shut down, and Idle (PfxCt) for one that went over its maximum-prefix limit. The second one does not recover on its own; it needs clear ip bgp or a restart timer.[13] See BGP Max-Prefix and Prefix-Limit for that case.

Connect

In Connect the router waits for its own TCP connection to complete. If it completes (E16 or E17) and DelayOpen is off, the router stops the ConnectRetryTimer, sends its OPEN, sets the hold timer to a large value ("A HoldTimer value of 4 minutes is suggested") and moves to OpenSent.[1] If the ConnectRetryTimer expires (E9), it drops the attempt, starts a new one and stays in Connect.

One detail surprises most people. If the TCP connection fails (E18) and no DelayOpenTimer is running, RFC 4271 sends the FSM back to Idle, not to Active.[1] Only with the DelayOpenTimer running does a failure move the session to Active. Many textbooks and vendor pages draw a plain "TCP fails → Active" arrow. Juniper, for example, writes that if the transport connection is not successful the state transitions to Active.[10] Most platforms do show Active for a neighbor whose TCP attempts fail, so for troubleshooting the simple version works. Just do not use it to argue about the RFC.

Active

The name is misleading: an Active neighbor is not active in the sense of "up". RFC 4271: "In this state, BGP FSM is trying to acquire a peer by listening for, and accepting, a TCP connection."[1] When the ConnectRetryTimer expires (E9), the router starts a new outgoing connection and moves back to Connect. If an incoming or outgoing connection succeeds, it sends its OPEN and moves to OpenSent. If a connection fails (E18), it increments the ConnectRetryCounter and goes to Idle.

The ConnectRetryTime suggested by the RFC is 120 seconds, with jitter: the RFC suggests multiplying the timer by a random factor between 0.75 and 1.0, so that many sessions do not retry at the same moment.[1] FRR uses 30 s in its traditional profile and 10 s in its datacenter profile, and GoBGP uses 120 s.[8][9] Juniper's troubleshooting guide gives the practical rule: "a neighbor state flip-flopping between Connect and Active is an indication that there is a problem with the TCP transport connection".[10] We cover the TCP side of this state in detail in BGP Active State Troubleshooting: TCP 179, Source IP and TTL.

OpenSent

The router has sent its OPEN and waits for the peer's. When the OPEN arrives, every field is checked: version, AS, hold time, BGP Identifier and optional parameters (see part 3 of this series for the byte layout). If it is valid (E19), the router sends a KEEPALIVE, sets the hold timer to the negotiated value, the lower of the two hold times, and moves to OpenConfirm. Here the session also becomes internal or external: if the AS in the OPEN equals the local AS, it is iBGP.[1] An error in the OPEN (E21 or E22) produces a NOTIFICATION with the matching code, for example 2/2 Bad Peer AS, and the FSM goes to Idle. If the TCP connection fails in OpenSent, the RFC moves the FSM back to Active and keeps listening.

If the peer accepts TCP but never answers with an OPEN, the 4-minute hold timer is the only thing that ends the wait: NOTIFICATION 4/0 Hold Timer Expired, then Idle. Our lab measured exactly that.

OpenConfirm

Both OPENs have been accepted and the router waits for the first KEEPALIVE. That KEEPALIVE (E26) restarts the hold timer and moves the session to Established.[1] While waiting, the router sends its own keepalives when its KeepaliveTimer expires. A NOTIFICATION (E25) or a TCP failure moves it to Idle. If the hold timer expires before a KEEPALIVE arrives, the router sends NOTIFICATION 4/0. This is also where collision detection runs: "Upon receipt of an OPEN message, the local system MUST examine all of its connections that are in the OpenConfirm state."[1] In practice OpenConfirm lasts milliseconds. A session that stays there usually means the peer rejected our OPEN and its NOTIFICATION never reached us.

Established

Only in Established do UPDATE messages flow. Every KEEPALIVE or UPDATE received restarts the hold timer. Every KEEPALIVE or UPDATE sent restarts the keepalive timer, unless the negotiated hold time is zero, in which case neither timer runs.[1] A ManualStop sends a Cease and "deletes all routes associated with this connection". An AutomaticStop does the same; the RFC's own example is a peer that sent more prefixes than the configured maximum.[1] A hold timer expiry, a received NOTIFICATION or a TCP failure also delete the routes and move the session to Idle. A malformed UPDATE (E28) used to end the session as well; since RFC 7606 most attribute errors are handled as treat-as-withdraw, and the session stays up.[7] Graceful restart (RFC 4724) changes that: a router that negotiated it keeps the peer's routes, marks them stale and keeps forwarding while the peer restarts.[4] RFC 8538 extends graceful restart to sessions that end with a NOTIFICATION, except for the new Hard Reset subcode (6/9).[3]

On Cisco the summary does not print the word Established. It prints the number of prefixes received in the State/PfxRcd column, so 0 means Established with no routes. That problem is covered in BGP Troubleshooting: Established but No Routes.[13]

Timers that drive the FSM

BGP FSM timers table: hold time, keepalive, ConnectRetry, OpenSent hold, IdleHold back-off, DelayOpen and SendHold in RFC, Cisco, Junos, FRR and GoBGP
Figure 2. FSM timers: RFC suggestions and real defaults. Hold time is the only one that is negotiated in the OPEN. A dash means we did not check that value for this article.

The hold time is the only negotiated timer. Each OPEN offers one, the session uses the smaller value, and the value must be 0 or at least 3 seconds.[1] Defaults differ: RFC 4271 suggests 90 s, Junos and GoBGP use 90 s, Cisco IOS XE and IOS XR use 60 s keepalive and 180 s hold, and FRR uses 60/180 in its traditional profile and 3/9 in its datacenter profile.[9][10][12] Two routers with different defaults simply run on the lower value. Cisco's IOS XR reference also notes that the configured keepalive must not exceed a third of the negotiated hold time; if it does, a third of the hold time is used.[12]

The ConnectRetry timer paces TCP attempts in Connect and Active. The hold time in OpenSent is not negotiated yet, so the RFC suggests a "large value" of 4 minutes; GoBGP hard-codes 240 s.[1][8] DelayOpen lets a router wait for the peer's OPEN before sending its own; FRR has it per neighbor (neighbor PEER timers delayopen (1-240)), off by default.[9] The IdleHold timer is the damping timer from the Idle section.

The newest one is the SendHoldTimer from RFC 9687 (2024). The classic hold timer only notices a peer that stops sending. It does not notice a peer that keeps the TCP window closed, so that our messages can never be sent. Such a session can stay Established for hours while nothing moves. RFC 9687 adds event 29, SendHoldTimer_Expires, and error code 8. Its suggested default is the greater of 8 minutes or twice the negotiated hold time, and it recommends that implementations enable it by default.[2]

For fast failure detection, do not push BGP timers down to a few seconds on every session. Use BFD (RFC 5880) and let it tear the session down; IANA's Cease subcode 10, BFD Down (RFC 9384), then records why.[5][17] Our article BGP Convergence Explained: BFD, PIC, Graceful Restart and Failover compares the options.

Connection collision: when both sides dial at once

Both peers normally try to connect, so two TCP connections between the same pair of routers can come up at the same time. RFC 4271 section 6.8 keeps only one. When an OPEN arrives, the router compares the BGP Identifiers as unsigned 32-bit numbers and keeps "the connection initiated by the BGP speaker with the higher-valued BGP Identifier". The other connection is closed with a Cease.[1] RFC 4486 assigns subcode 7, Connection Collision Resolution, to that Cease.[3] If a session is already Established, a new colliding connection is closed unless CollisionDetectEstablishedState is configured.[1]

BGP connection collision detection: two TCP connections and the BGP Identifier rule from RFC 4271 section 6.8
Figure 3. Connection collision detection. The router with the higher BGP Identifier wins: the connection that it opened survives.

A collision costs a few hundred milliseconds and an extra Cease in the logs, not an outage. Implementations try to avoid it. GoBGP 4.11 waits a random 0 to 1 second before its first connection attempt after leaving Idle; the source comment explains that only the random part makes the two sides connect at different times.[8] The same pattern explains a common design choice: on route servers and hubs with hundreds of peers, one side is often set to passive so that only one side ever dials.

Lab: five sessions, five failures (GoBGP 4.11)

We ran three GoBGP 4.11 routers on loopback addresses with debug logging, plus a Python script that played three more "peers" byte by byte.[16] Router r1 (AS 65001, 127.0.2.41) had five neighbors:

  • 127.0.2.42 = r2 (AS 65002): a normal eBGP session that we later disabled, enabled and reset.
  • 127.0.2.43: a Python listener that accepts TCP and never sends an OPEN.
  • 127.0.2.44: a Python peer that sends an OPEN with hold time 6 (later 9) and never sends a KEEPALIVE.
  • 127.0.2.45: a Python peer that brings the session to Established with hold time 6 and then goes silent.
  • 127.0.2.46 = r3: really AS 65003, but r1 is configured with peer-as = 65033.
# r1.toml (excerpt), GoBGP 4.11
[global.config]
  as = 65001
  router-id = "10.0.0.41"
  port = 10179
  local-address-list = ["127.0.2.41"]
[[neighbors]]
  [neighbors.config]
    neighbor-address = "127.0.2.46"
    peer-as = 65033              # wrong on purpose: r3 is AS 65003
  [neighbors.transport.config]
    remote-port = 10179
    local-address = "127.0.2.41"
  [neighbors.timers.config]
    hold-time = 90
    keepalive-interval = 30
    connect-retry = 10
Timeline of BGP neighbor states for five sessions in a GoBGP 4.11 lab with different faults
Figure 4. State of each session over 300 seconds, from the GoBGP 4.11 debug log. GoBGP 4.11 lab output, 29 November 2026, 01:20-01:25 CET.

1. Bring-up: Idle, Active, then Established in 0.67 s

r1 started alone, so all five neighbors went from Idle to Active and the TCP attempts were refused:

level=DEBUG msg="state changed" Key=127.0.2.42 old=BGP_FSM_IDLE new=BGP_FSM_ACTIVE reason=idle-hold-timer-expired
level=DEBUG msg="failed to connect" Key=127.0.2.42 Error="dial tcp 127.0.2.41:0->127.0.2.42:10179: connect: connection refused"

With connect-retry = 10, the measured gaps between attempts were 7.8 to 9.9 seconds (7.88, 9.87, 8.82, 8.49, 9.78, 7.77 s towards r3's address). That is the 0.75-1.0 jitter range of RFC 4271 applied to 10 s, and GoBGP's source says it implements exactly that.[1][8] When r2 started 20 seconds later, its session went Idle → Active → OpenSent → OpenConfirm → Established within 0.67 s. The two routers logged the same session differently:

# r2 (accepted r1's connection)
01:20:45.866 state changed old=BGP_FSM_IDLE        new=BGP_FSM_ACTIVE      reason=idle-hold-timer-expired
01:20:46.529 state changed old=BGP_FSM_ACTIVE      new=BGP_FSM_OPENCONFIRM reason=open-msg-received
01:20:46.531 state changed old=BGP_FSM_OPENCONFIRM new=BGP_FSM_ESTABLISHED reason=open-msg-negotiated
# r1, a later re-connect where r1 dialed out
01:22:07.275 msg="open message received on outgoing connection" remote=127.0.2.42:10179
01:22:07.275 state changed old=BGP_FSM_ACTIVE      new=BGP_FSM_OPENCONFIRM reason=open-msg-received

GoBGP never shows a Connect state. Its outgoing connection is handled by a separate connection manager, and the FSM jumps from Active to OpenConfirm when the OPEN arrives on that connection. The RFC allows this, since the FSM is conceptual. But it means "I never saw Connect" tells you nothing on this platform.[1][8]

2. Stuck in OpenSent for 240 seconds, shown as Active

The listener on 127.0.2.43 accepted r1's TCP connection at 26.876 s and received r1's 70-byte OPEN (hold time 90). Then it said nothing. Exactly 240.0 seconds later, at 266.877 s, r1 sent NOTIFICATION 4/0 and closed the connection:

01:20:52.706 msg="outgoing connection established" Key=127.0.2.43
01:24:52.706 msg="outgoing connection closing due to hold timer expired in OPEN SENT state" Key=127.0.2.43
01:24:52.706 msg="sent notification" Key=127.0.2.43 State=BGP_FSM_ACTIVE Code=4 Subcode=0

That is the RFC's "large value" of 4 minutes. Note the state in the last line: BGP_FSM_ACTIVE. During the whole 240 seconds gobgp neighbor printed Active for this peer, because the OpenSent state lived on the outgoing connection, not in the main FSM. A real-world version is a firewall or load balancer that terminates TCP 179 but has no BGP behind it: the CLI shows a harmless-looking Active, and only a capture (our OPEN out, nothing back) shows what is going on.

3. OpenConfirm without a KEEPALIVE

The peer on 127.0.2.44 sent an OPEN with hold time 6, received r1's OPEN and KEEPALIVE, and then stayed silent. RFC 4271 says the local system should send keepalives in OpenConfirm and, if no KEEPALIVE arrives before the hold timer expires, send NOTIFICATION 4/0 and go to Idle.[1] GoBGP 4.11 did neither. It sent no further keepalives and showed this:

$ gobgp neighbor 127.0.2.44          # 130 s after the peer's OPEN (hold 9)
  BGP state = SESSION_STATE_OPENCONFIRM
  Hold time is 0, keepalive interval is 0 seconds
  Configured hold time is 90, keepalive interval is 30 seconds

We repeated the test with hold time 9 and waited 130 seconds: no keepalive, no NOTIFICATION, and the state stayed OpenConfirm. It ended only when our side closed TCP. In GoBGP's code the OpenConfirm handler arms the hold timer only if the negotiated hold time is non-zero, and the CLI showed it as 0 at that point.[8] We saw this on a passive (inbound) connection in GoBGP 4.11.0 and have not tested other versions. The general lesson holds on any platform: a state machine that waits for something that never comes depends on its timers, and a missing timer can leave a session stuck.

4. Established, then silence: hold timer expiry

The peer on 127.0.2.45 offered hold time 6, so GoBGP sent keepalives every 2.0 seconds (6/3) and the session came up. At 49.121 s we stopped sending keepalives. GoBGP kept sending its own, at 51.12, 53.12 and 55.12 s, and at 55.122 s, 6.0 s after our last message, it sent NOTIFICATION 4/0:

01:21:20.951 WARN msg="hold timer expired" Key=127.0.2.45 State=BGP_FSM_ESTABLISHED
01:21:20.951 msg="sent notification" Key=127.0.2.45 Code=4 Subcode=0
01:21:20.951 msg="Peer Down" Key=127.0.2.45 Reason=hold-timer-expired
01:21:21.202 WARN msg="Closed an accepted connection" Key=127.0.2.45 State=BGP_FSM_IDLE
  ... 7 attempts, every 0.25 s, all closed ...
01:21:22.952 msg="IdleHoldTimer expired" Key=127.0.2.45 Duration=2

Our script then tried to reconnect every 0.25 seconds. For 2.0 seconds every attempt was reset, because r1 was in Idle and "refuses all incoming BGP connections". After 2 s the IdleHoldTimer expired and the next attempt got an OPEN back. This is the Idle back-off in its smallest form: 1 second doubled once after the error.

5. Bad Peer AS: watching the back-off grow

BGP IdleHoldTimer back-off measured in a GoBGP lab: 2, 4, 8, 16, 32 and 64 seconds after Bad Peer AS notifications
Figure 5. Idle time after each NOTIFICATION 2/2 between r3 and r1. GoBGP 4.11 lab output.

r1 expected AS 65033, r3 sent AS 65003. Every OPEN exchange ended in OpenSent on r1 with NOTIFICATION 2/2 Bad Peer AS, and r3 logged notification-received code 2(open) subcode 2(bad peer as). r3's Idle time then doubled every round: 2, 4, 8, 16, 32 and 64 seconds, seven failed sessions in 130 seconds, with 120 s as the cap for the next round. FRR's code does the same, doubling its start timer in bgp_stop_with_error() up to 120 s.[8][9] The other side did not back off the same way. r1's own outgoing attempts failed while r3 sat in Idle (r3 closed them), so r1 kept dialing every 1.5 to 2.0 seconds from its connection manager. Two implementations, even two copies of the same one, can disagree about how hard to retry.

The fix is a configuration change, and it takes effect on the next attempt. With a 64-second back-off, though, "I fixed it and nothing happened" is normal for up to two minutes. A manual reset clears the back-off.

6. Admin down, admin up and a hard reset

$ gobgp neighbor 127.0.2.42 disable
level=INFO msg="sent notification" Key=127.0.2.42 State=BGP_FSM_ESTABLISHED Code=6 Subcode=2
$ gobgp neighbor
Peer          AS  Up/Down State       |#Received  Accepted
127.0.2.42 65002    never Idle(Admin) |        0         0
$ gobgp neighbor 127.0.2.42 enable          # 15 s later: Established after 1.2 s
$ gobgp neighbor 127.0.2.42 reset           # Cease 6/4, then 30 s in Idle
127.0.2.42 65002 00:00:25 Idle        |        0         0
127.0.2.42 65002 00:00:05 Establ      |        0         0

disable sent Cease 6/2 Administrative Shutdown. GoBGP showed Idle(Admin), like Cisco's Idle (Admin). On r2 the session went to Idle for 2 s and then to Active, and its connection attempts arrived every 1.6 to 1.8 s. r1 rejected all eight with New connection for non admin-state-up peer. After enable the session was Established 1.2 s later. A reset sent Cease 6/4 Administrative Reset, and r1 then stayed in Idle for exactly 30 s, GoBGP's idle-hold-time-after-reset default, before the session came back after 30.1 s.[8] Finally, when we stopped r1, r2 received Cease 6/3 Peer De-configured.

Real neighbor states on RouteViews

Real BGP neighbor states on the RouteViews collector: Established peers and peers stuck in Active or Idle
Figure 6. Neighbor states on route-views.routeviews.org (Cisco IOS XE, AS 6447) on 29 November 2026, 00:27 UTC.

RouteViews' main collector had 23 neighbors at 00:27 UTC on 29 November 2026. Nineteen were Established; the summary showed them as prefix counts, from 294 to 1,112,805 prefixes. Four were not.[15] Three showed Active with MsgRcvd 0, down for 7 weeks 5 days (AS 3257), 1 year 28 weeks (AS 852) and 1 year 1 week (AS 3561). The detail for the AS 3257 neighbor shows the typical pattern of an outgoing connection that fails:

route-views>show ip bgp neighbors 89.149.178.10 | include BGP state|Last reset|Connections established
  BGP state = Active
  Connections established 84; dropped 84
  Last reset 7w5d, due to Active open failed
  No active TCP connection

The fourth neighbor, AS 4901, showed Idle in the summary at 00:27:03 UTC and Active about 30 seconds later, with Connections established 8; dropped 8. That is the Idle ↔ Active cycle of a router that retries, fails and waits. For comparison, a healthy neighbor (AS 3356) showed BGP state = Established, up for 3w0d and hold time is 90, keepalive interval is 30 seconds, the RFC 4271 suggestion.[15] A collector with 23 peers is a small sample, but it shows that sessions in Active can stay unnoticed for years.

Troubleshooting BGP neighbor states

Troubleshooting map for a BGP neighbor stuck in Idle, Active, OpenSent, OpenConfirm or flapping
Figure 7. Where is the session stuck? The state points at the layer to check first.

Commands per platform

! Cisco IOS XE
show ip bgp summary                               ! Idle / Active / Idle (Admin) / Idle (PfxCt) / prefix count
show ip bgp neighbors 192.0.2.1 | include BGP state|Last reset|Connections|Hold time
debug ip bgp events                               ! state changes, in a maintenance window

! Cisco IOS XR
show bgp neighbor 192.0.2.1 | include BGP state|Last reset|Hold time
router bgp 64500
 neighbor 192.0.2.1
  session-open-mode passive-only                  ! only listen, never dial

# Junos
show bgp summary
show bgp neighbor 192.0.2.1 | match "State|Last State|Last Event|Last Error|Flags"
set protocols bgp log-updown                      # log every state change
set protocols bgp group upstream neighbor 192.0.2.1 passive

# FRR
show bgp summary
show bgp neighbors 192.0.2.1                      ! "BGP state =", "Last reset", connect timer
router bgp 64500
 bgp log-neighbor-changes
 neighbor 192.0.2.1 timers connect 30
 neighbor 192.0.2.1 timers delayopen 10

# Any Linux box on the path
tcpdump -ni eth0 'tcp port 179'

The commands follow the vendors' documentation; adjust addresses and AS numbers to your network.[9][10][11][12][14] Junos's show bgp neighbor is especially useful because it prints the previous state, the last event (for example ConnectRetry, HoldTime, RecvKeepAlive) and the last error, so you get a small history without debugging.[10]

A checklist by state

  1. Idle. Is the neighbor shut down? Is a maximum-prefix limit holding it down? Is there a route to the neighbor address? Is a back-off timer running after earlier errors? Read Last reset or Last error before you change anything.
  2. Connect / Active. Ping the neighbor from the source address the session uses. Test TCP 179 in both directions (telnet 192.0.2.1 179 with a source address). Check ACLs and control-plane policers on port 179, MD5 or TCP-AO keys, update-source or local-address, and TTL. An eBGP session between loopbacks needs multihop, and with GTSM (RFC 5082) the sender uses TTL 255 and the receiver drops packets that arrive with a lower TTL than expected.[6] Also check that both sides are not configured as passive.
  3. OpenSent. TCP works, BGP does not answer. Capture to confirm that your OPEN leaves and nothing comes back. Look for a middlebox that terminates TCP, or a peer whose BGP process is overloaded or hung.
  4. OpenConfirm. Rare and short. If it persists, read the peer's logs for a NOTIFICATION you never received, and check for one-way packet loss.
  5. Established but flapping. Read the NOTIFICATION code: 4/0 hold timer (loss, CPU, a policer dropping keepalives), 6/1 maximum prefixes, 6/10 BFD down, code 8 send hold timer expired. Interface errors and an MTU black hole that drops only large UPDATEs are common causes of 4/0 that appear right after the initial table transfer starts.[2][3][17]

Common mistakes

MistakeWhy it hurtsBetter
Reading Active as "up"Active means TCP is still failingOnly Established (or a prefix count on Cisco) is up
Clearing the session again and again while it is in IdleEach error can lengthen the back-off; the real cause is still thereRead the last NOTIFICATION or reset reason first
Hold time 3-9 s on every eBGP sessionKeepalives compete with CPU and control-plane policers; one busy moment drops the sessionBFD for detection, moderate BGP timers
Both sides passiveNobody dials; both stay in Active foreverPassive on one side only
Trusting the state name across platformsGoBGP showed Active during 240 s of OpenSent; Cisco hides Established behind a numberCheck logs and the platform's own documentation
Expecting a fixed peer to come up at onceThe other side may be in a 64-120 s back-offWait two minutes or reset the session on both sides

FAQ

What are the six BGP neighbor states?

Idle, Connect, Active, OpenSent, OpenConfirm and Established, defined in RFC 4271 section 8. Idle refuses connections, Connect and Active deal with the TCP connection on port 179, OpenSent and OpenConfirm exchange and check the OPEN messages, and Established is the only state in which UPDATE messages carry routes.

Does BGP state Active mean the session is up?

No. Active means the router is still trying to get a TCP connection to the neighbor: it listens and retries when the ConnectRetry timer expires. An up session shows Established, or on Cisco a number in the State/PfxRcd column, which is the count of prefixes received.

Why is my BGP neighbor stuck in Idle?

Idle means the router is not trying at that moment. Typical reasons are a neighbor shutdown (Idle (Admin) on Cisco), a maximum-prefix limit that tripped (Idle (PfxCt)), no route to the neighbor address, or a back-off timer after repeated errors. Implementations such as FRR and GoBGP double the time spent in Idle after every error, up to 120 seconds.

What is the difference between the Connect and the Active state?

In Connect the router waits for its own outgoing TCP connection to complete. In Active it waits for the ConnectRetry timer and listens for an incoming connection. If the TCP attempt fails, many implementations show Active; a neighbor that alternates between Connect and Active has a TCP or IP reachability problem.

How long does a BGP session stay in OpenSent?

Until the peer's OPEN arrives or the hold timer expires. RFC 4271 suggests a large hold time of 4 minutes for this state. In our GoBGP 4.11 lab a peer that accepted TCP but never sent an OPEN was dropped with NOTIFICATION 4/0 exactly 240.0 seconds after our OPEN.

What are the default BGP hold and keepalive timers?

RFC 4271 suggests 90 seconds hold time and a keepalive at one third of it. Cisco IOS XE and IOS XR default to 60 s keepalive and 180 s hold, Junos and GoBGP to 90 s hold, and FRR to 60/180 in its traditional profile and 3/9 in its datacenter profile. The session uses the lower of the two hold times offered in the OPEN messages.

What happens when two BGP routers connect to each other at the same time?

That is a connection collision (RFC 4271 section 6.8). Each side compares the BGP Identifiers and keeps the TCP connection opened by the router with the higher identifier; the other connection is closed with a Cease NOTIFICATION, subcode 7 Connection Collision Resolution (RFC 4486).

References (all read on 29 November 2026)
[1] Y. Rekhter, T. Li, S. Hares (eds.), "RFC 4271: A Border Gateway Protocol 4 (BGP-4)," January 2006: section 6.8 (collision detection), section 8 (FSM, events 1-28, states), section 10 (timer defaults and jitter).
[2] J. Snijders, B. Cartwright-Cox, Y. Qu, "RFC 9687: Border Gateway Protocol 4 (BGP-4) Send Hold Timer," November 2024.
[3] E. Chen, V. Gillet, "RFC 4486: Subcodes for BGP Cease Notification Message," April 2006; K. Patel et al., "RFC 8538: Notification Message Support for BGP Graceful Restart," March 2019.
[4] S. Sangli et al., "RFC 4724: Graceful Restart Mechanism for BGP," January 2007.
[5] D. Katz, D. Ward, "RFC 5880: Bidirectional Forwarding Detection (BFD)," June 2010.
[6] V. Gill et al., "RFC 5082: The Generalized TTL Security Mechanism (GTSM)," October 2007.
[7] E. Chen, J. Scudder, P. Mohapatra, K. Patel, "RFC 7606: Revised Error Handling for BGP UPDATE Messages," August 2015.
[8] GoBGP v4.11.0 source code: pkg/server/fsm.go (holdtimeOpensent 240, idle hold back-off 1-120 s, connect jitter, first-connect delay, OpenConfirm handler) and pkg/config/oc/default.go (hold 90, connect-retry 120, idle-hold-time-after-reset 30).
[9] FRRouting: BGP documentation (timers connect, timers delayopen, minimum-holdtime), Basic Commands (traditional and datacenter profiles), and source bgpd/bgp_fsm.c + bgpd.h (start timer back-off, default timers).
[10] Juniper Networks, "Troubleshooting BGP Sessions" and "show bgp neighbor" (states, Last State, Last Event, Last Error, flags); Junos hold-time default 90 s and passive statement.
[11] Cisco, "Understand Basic BGP Troubleshoot," document 220604, February 2024.
[12] Cisco, IOS XE BGP command reference (neighbor timers, timers bgp: keepalive 60 s, holdtime 180 s) and IOS XR BGP command reference for NCS 5500 (timers, negotiated hold time, keepalive limit).
[13] Noction, "Debugging BGP states" and "BGP errors, BGP error codes, and BGP error handling" (Idle (Admin), Idle (PfxCt), Active).
[14] Cisco IOS XR configuration model, router bgp: session-open-mode active-only / passive-only / both.
[15] University of Oregon RouteViews, route-views.routeviews.org (telnet, user rviews): show ip bgp summary and show ip bgp neighbors, captured 29 November 2026, 00:27:03-00:27:50 UTC.
[17] IANA, "Border Gateway Protocol (BGP) Parameters": error codes (8 Send Hold Timer Expired) and Cease subcodes (7 Connection Collision Resolution, 9 Hard Reset, 10 BFD Down).
[16] Network freak lab: GoBGP 4.11.0 routers r1 (AS 65001, 127.0.2.41), r2 (AS 65002), r3 (AS 65003) with debug logging and raw Python BGP peers 127.0.2.43-45, 29 November 2026, 01:20-01:28 CET. Logs kept with the article sources.
Figures 1-7: Network freak, drawn from the sources above and our own lab and RouteViews captures.

Try it: BGP Route Lookup: origin AS, AS paths and RPKI check - free, runs in your browser.

Comments

Popular posts from this blog

BGP Neighbor States

Reason legend in show ip ospf statistics

Cisco SPAN Port Mirroring for Troubleshooting