Stuck in Active: Troubleshooting BGP Sessions at the TCP Layer
Reading Idle, Connect and Active
A BGP neighbour that never comes up is one of the most common tickets in any network, and most of them have nothing to do with BGP itself. Before two routers can exchange a single BGP message, they need a working TCP connection to port 179. The BGP state you see in "#show ip bgp summary" is a direct report on how far that connection got, and learning to read it saves hours.
R1#show ip bgp summary
BGP router identifier 1.1.1.1, local AS number 65001
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2.2.2.2 4 65002 0 0 1 0 0 never Idle
4.4.4.4 4 65001 0 0 1 0 0 never Active
10.1.13.3 4 65003 0 0 1 0 0 00:00:12 OpenSent
Three neighbours, three different problems. The state names come from the BGP finite state machine, and the first three map almost directly onto TCP.
Idle means BGP is not even trying to connect. The neighbour may be administratively shut down, there may be no route to its address, or for eBGP the neighbour may not be on a connected subnet and no multihop or connected-check option is configured. Idle is the router telling you it has a reason not to start.
Connect means the router is actively trying to open the TCP connection and is waiting for the handshake to finish. You rarely see it for long, because the attempt either succeeds or fails quickly.
Active is the most misleading name in networking. It does not mean the session is active. It means the TCP connection attempt failed, and the router is now waiting, listening on port 179 for the neighbour to connect, before trying again itself. A neighbour stuck in Active is a neighbour whose TCP handshake keeps failing.
The states after that belong to BGP proper. OpenSent means TCP succeeded and an OPEN message was sent, so the router is waiting for the neighbour's OPEN. Cisco shows the next state as OpenReceive, where the RFC calls it OpenConfirm. A neighbour stuck in OpenSent or bouncing back to Idle after OPEN usually has a BGP parameter mismatch, such as a wrong AS number, rather than a TCP problem. The rest of this post deals with the first three states.
A Method That Works Every Time
With the states understood, a fixed sequence of checks finds almost every TCP-level fault, and it always starts with reachability.
The first check is the route. TCP needs a route to the neighbour's address, from the address the router will source the session from. For iBGP between loopbacks, both loopbacks must be in the IGP, and "#neighbor update-source" must point to the right interface. A missing update-source is the most common iBGP mistake: R1 sources the SYN from its physical interface, R4 sees a connection from an address it does not have configured as a neighbour, and refuses it.
R1#show ip route 4.4.4.4
% Subnet not in table
That answer ends the investigation for neighbour 4.4.4.4. No route means no SYN, and the neighbour can only stay in Active. Fix the IGP before looking at anything else.
The second check is whether the SYN gets an answer. The fastest tool is a BGP debug filtered to one neighbour, because it reports why the connection attempt failed.
R1#debug ip bgp 10.1.14.4
BGP debugging is on for neighbor 10.1.14.4 for address family: IPv4 Unicast
R1#
BGP: 10.1.14.4 open active, local address 10.1.14.1
BGP: 10.1.14.4 open failed: Connection refused by remote host, open active delayed 9634ms (35000ms max, 60% jitter)
"Connection refused by remote host" means the neighbour's TCP stack answered with a reset. The packet arrived, but nothing on that router was willing to accept a BGP connection from this source. The usual causes are that the neighbour has no "#neighbor" statement for this address, has the session shut down, or expects the connection from a different source address. This message only appears in the debug output, not as a syslog message, which is why so many engineers never see it.
If the debug shows the attempt timing out instead of being refused, the SYN or its reply is being lost on the way. Look for an ACL or firewall dropping TCP port 179 in one direction, a uRPF check failing because of asymmetric routing, or TTL settings that cause the packets to be discarded. The handshake has a time limit too: "#ip tcp synwait-time" defaults to 30 seconds, after which a half-open attempt is abandoned.
The third check is the TCP table itself, which shows what the router is listening for and what it has connected.
R1#show tcp brief all
TCB Local Address Foreign Address (state)
7FBA5C4D2A10 10.1.12.1.179 10.1.12.2.52713 ESTAB
7FBA5C4E1B88 10.1.13.1.179 10.1.13.3.* LISTEN
7FBA5C4F0C20 1.1.1.1.179 4.4.4.4.* LISTEN
The LISTEN lines show which neighbours R1 will accept a connection from, and on which local address. A neighbour that is listening on the wrong local address, here a loopback when the remote side sends from a physical interface, will never match.
The fourth check is authentication and TTL, the two settings that silently discard packets. A password mismatch produces %TCP-6-BADAUTH log messages, which are easy to find. A TTL security mismatch produces nothing at all, because failing packets are dropped without an ICMP reply, so compare the TTL lines on both sides.
R1#show ip bgp neighbors 10.1.13.3 | include TTL|BGP state
BGP state = Active
Connection is ECN Disabled, Mininum incoming TTL 254, Outgoing TTL 255
If the other router shows "Outgoing TTL 1" for this session, its packets arrive with a TTL of 1, fail R1's minimum of 254, and disappear. Configure TTL security on both sides or on neither.
Who Connects, and Platform Details
Once the basic checks pass, a final group of problems comes from which side is allowed to open the connection. Both BGP speakers normally try to connect, so the session usually forms even if only one direction is allowed through a firewall. That stops being true when one side is configured as passive. On IOS XE "#neighbor transport connection-mode passive" makes a router only listen. If both sides are set to passive, neither ever sends a SYN, and both sit in Active forever with no error at all.
R1#show ip bgp neighbors 10.1.12.2 | include BGP state|Connection mode
BGP state = Active
Connection mode is passive
IOS XR uses "#session-open-mode" with active-only, passive-only or both, where both is the default. In a mixed network, check both platforms' settings, because a passive-only XR router facing a passive IOS XE router produces exactly the same silent failure.
A related case is the connection collision, when both routers succeed in connecting at the same moment. That is not a fault. BGP keeps the connection opened by the router with the higher BGP identifier and closes the other, so a brief extra TCP connection in "#show tcp brief" during session setup is normal.
The method condenses into one sentence worth keeping on a sticky note: route, refuse, listen, authenticate. Check that a route to the neighbour exists from the right source, find out with a filtered debug whether the attempt is refused or lost, read the TCP table for what is listening, and compare authentication and TTL on both ends. Only when TCP is Established and the state moves to OpenSent does the problem become a BGP problem, and that is the subject of the modules that follow.