Border Gateway Protocol (BGP) is responsible for exchanging routing information between autonomous systems and is widely used in enterprise networks, internet service provider infrastructure, cloud connectivity, and large-scale data centers.
However, a BGP configuration can look correct while the neighbor session remains down.
You might see a peer repeatedly switching between Connect and Active, remaining in Idle, or reaching OpenSent before returning to Idle.
These states indicate different stages of the BGP session establishment process. A neighbor stuck in Active often points to a TCP connectivity problem, while a session that reaches OpenSent may be encountering an issue during the exchange of BGP OPEN messages.
Common causes include:
update-source configuration.ebgp-multihop configuration.This BGP neighbor troubleshooting guide explains the BGP Finite State Machine (FSM), provides practical Cisco IOS, Linux FRRouting (FRR), and Juniper Junos commands, and shows how to diagnose common session failures step by step.
The primary objective is to establish a stable BGP session before investigating route advertisement and path-selection problems.
BGP uses a client-server-style TCP connection between neighboring routers.
Unlike OSPF, which discovers neighboring routers through Hello packets, BGP peers are normally configured explicitly.
The two routers must be able to reach each other’s configured peer addresses and establish a TCP connection before exchanging BGP OPEN messages.
BGP uses TCP port 179.
A simplified connection process looks like this:
+----------------------+ +----------------------+
| Router A | | Router B |
| | | |
| Local AS: 65001 | | Local AS: 65002 |
| Peer: 192.0.2.2 | | Peer: 192.0.2.1 |
| | | |
| TCP SYN |------------>| |
| |<------------| TCP SYN-ACK |
| TCP ACK |------------>| |
| | | |
| BGP OPEN |------------>| |
| BGP OPEN |<------------| |
| KEEPALIVE |------------>| |
| KEEPALIVE |<------------| |
| | | |
| ESTABLISHED |<----------->| ESTABLISHED |
+----------------------+ +----------------------+ After the TCP session is established, the routers exchange BGP OPEN messages.
These messages contain important information, including:
If the session parameters are acceptable, the routers exchange KEEPALIVE messages and enter the Established state.
They can then exchange UPDATE messages containing routing information.
The protocol is defined in RFC 4271 — A Border Gateway Protocol 4 (BGP-4).
BGP uses a Finite State Machine to manage each configured peer relationship.
Understanding these states is the fastest way to identify where session establishment is failing.
| BGP State | Meaning | What to Investigate |
|---|---|---|
| Idle | BGP is waiting for a start event or recovering from an error | Configuration, administrative state and notifications |
| Connect | Waiting for the TCP connection to complete | Peer reachability and TCP 179 |
| Active | Attempting to establish or re-establish TCP connectivity | Firewall, routing and remote peer |
| OpenSent | OPEN message has been sent; waiting for the peer’s OPEN | AS number and OPEN parameters |
| OpenConfirm | Waiting for KEEPALIVE or NOTIFICATION | Session parameters and peer response |
| Established | BGP session is operational | Prefix advertisements and routing policies |
The Idle state is the initial state of a BGP session.
The BGP process waits for a start event, such as the activation of a configured neighbor.
A router may also return to Idle after receiving a BGP NOTIFICATION message or detecting a session error.
Possible causes include:
Check the neighbor configuration and inspect logs before repeatedly clearing the session.
On Cisco IOS:
show ip bgp summary Then inspect the affected neighbor:
show ip bgp neighbors 192.0.2.2 The Connect state means that BGP is waiting for the TCP connection to complete.
The router has attempted to establish a TCP session with the configured peer.
If the TCP handshake succeeds, BGP normally moves to OpenSent.
If the connection fails, the session may move to Active.
Investigate:
The Active state does not mean that the BGP session is successfully established.
It means that the router is trying to acquire the peer by initiating a TCP connection and listening for an incoming connection.
A peer repeatedly moving between Connect and Active commonly indicates a TCP transport problem.
For example:
BGP Neighbor: 192.0.2.2
Connect
|
v
TCP connection fails
|
v
Active
|
v
ConnectRetry expires
|
v
Connect
|
v
TCP connection fails Possible causes include:
Do not assume that Active means the router is successfully communicating with its peer. It is a troubleshooting state that requires checking transport connectivity.
In the OpenSent state, the local router has sent a BGP OPEN message and is waiting for the remote peer’s OPEN message.
At this point, the TCP connection has progressed beyond basic transport establishment.
Potential problems include:
Check the BGP logs and inspect the session details to determine whether the remote peer rejected the OPEN message.
The OpenConfirm state indicates that the BGP router is waiting for a KEEPALIVE or NOTIFICATION message from its peer.
A session that remains in this state or repeatedly returns to Idle may indicate:
The Established state indicates that the BGP session has been successfully established.
The routers can exchange routing information using UPDATE messages and maintain the relationship using KEEPALIVE messages.
However, an established session does not automatically mean that the router is receiving the expected routes.
For that, you must separately investigate address families, prefix advertisements, route policies, and BGP path selection.
Before modifying the configuration, inspect the complete BGP neighbor table.
On Cisco IOS and IOS XE:
show ip bgp summary On platforms using the newer address-family syntax:
show bgp ipv4 unicast summary Example:
BGP router identifier 192.0.2.1, local AS number 65001
Neighbor V AS MsgRcvd MsgSent Up/Down State/PfxRcd
192.0.2.2 4 65002 150 148 01:25:40 12
192.0.2.3 4 65003 0 0 never Active
192.0.2.4 4 65004 0 0 never Idle Interpret the output:
12 means the peer is Established and 12 prefixes are received in this address family.Active means the session is not established and is attempting to establish connectivity.Idle means the session is not currently established.Up/Down indicates how long the session has been up or how long it has been down.An important detail: Cisco displays a numeric prefix count in the State/PfxRcd column when the session is established. A textual state such as Active or Idle indicates that the session has not reached Established.
Start with the affected neighbor and avoid clearing all BGP sessions unnecessarily.
A neighbor stuck in Idle may indicate an administrative or configuration issue.
On Cisco IOS:
show running-config | section router bgp Check whether the correct local AS number is configured.
Example:
router bgp 65001
neighbor 192.0.2.2 remote-as 65002 Confirm that the peer is configured under the correct BGP process.
Inspect the configuration:
show running-config | include neighbor Look for a command similar to:
neighbor 192.0.2.2 shutdown If the neighbor is intentionally configured as shutdown, it will not establish a normal session.
To enable it:
router bgp 65001
no neighbor 192.0.2.2 shutdown Only apply this change when the neighbor is supposed to be operational.
Check system logs:
show logging Look for BGP messages indicating:
These messages can narrow down the exact cause without unnecessarily changing the configuration.
Check:
show ip bgp neighbors 192.0.2.2 Confirm that:
If the neighbor is in Idle, do not immediately assume that TCP 179 is blocked. Verify the session configuration and logs first.
A BGP session repeatedly stuck in Active is one of the most common neighbor establishment problems.
Because BGP uses TCP, connectivity must exist between the two configured peer addresses.
From Router A, test Router B’s peer address:
ping 192.0.2.2 If the peer is reached through a particular source interface, test using that source when supported:
ping 192.0.2.2 source 192.0.2.1 A successful ping provides useful evidence of IP reachability.
However, ping success alone does not prove that TCP port 179 is reachable.
On a Linux router or diagnostic host:
nc -vz 192.0.2.2 179 This checks whether a TCP connection can be established to port 179.
Possible results:
| Result | Meaning |
|---|---|
| Connection succeeds | TCP connection reached the listening service |
| Connection refused | Destination is reachable but the TCP connection was rejected |
| Connection times out | Packets may be blocked, dropped, or not reaching the peer |
| No route to host | Routing or local network reachability problem |
A successful TCP test does not guarantee that the BGP OPEN negotiation will succeed.
It only confirms that the transport connection can be established.
Cisco also documents testing TCP port 179 as part of BGP session troubleshooting in its BGP basic troubleshooting guide.
BGP uses TCP port 179.
Inspect ACLs and firewall policies on both sides of the connection.
On Cisco:
show access-lists Check whether the policy permits the required TCP traffic between the peer addresses.
A basic extended ACL example for permitting a connection from one known peer is:
access-list 110 permit tcp host 192.0.2.1 host 192.0.2.2 eq 179 The actual direction and placement depend on where the ACL is applied.
On Linux, inspect firewall rules using the appropriate system firewall:
sudo nft list ruleset Or, where iptables is used:
sudo iptables -L -n -v Remember that a stateful firewall normally permits return traffic for an allowed connection, while stateless ACLs may require explicit rules for both directions.
Do not open TCP port 179 to the entire internet. Restrict BGP access to the intended peer addresses.
On Linux:
sudo ss -lntp | grep ':179' The output should show a BGP daemon listening on the expected address and port.
If there is no listener, check the BGP process and configuration on the remote router.
When the problem remains unclear, use tcpdump:
sudo tcpdump -ni eth0 'tcp port 179' Look for the TCP handshake:
SYN
SYN-ACK
ACK Interpret common patterns:
For more advanced packet-analysis techniques, see our Wireshark Explained guide.
One of the most common configuration mistakes is using the wrong remote autonomous system number.
Consider the following topology:
Router A Router B
Local AS: 65001 Local AS: 65002
Peer IP: 192.0.2.2 Peer IP: 192.0.2.1
neighbor 192.0.2.2 neighbor 192.0.2.1
remote-as 65002 remote-as 65001 Both routers must agree on the other’s AS number.
A correct Cisco configuration on Router A is:
router bgp 65001
neighbor 192.0.2.2 remote-as 65002 On Router B:
router bgp 65002
neighbor 192.0.2.1 remote-as 65001 Run:
show ip bgp neighbors 192.0.2.2 Check the remote AS information.
Also review:
show running-config | section router bgp Look for:
In external BGP, the remote AS should match the peer’s expected AS number.
In internal BGP, both peers normally belong to the same AS.
The update-source command controls the local interface address used when establishing a BGP session.
This is especially important when using loopback interfaces for iBGP or eBGP sessions.
Consider:
Router A Router B
Loopback0: 10.1.1.1/32 Loopback0: 10.2.2.2/32
<------- Routed Network -------> Router A expects the BGP neighbor to be 10.2.2.2, and Router B expects 10.1.1.1.
The local router must use the intended loopback as the source address.
router bgp 65001
neighbor 10.2.2.2 remote-as 65001
neighbor 10.2.2.2 update-source Loopback0 router bgp 65001
neighbor 10.1.1.1 remote-as 65001
neighbor 10.1.1.1 update-source Loopback0 Both routers also need IP reachability to the remote loopback.
For example, the underlying IGP or static routing must provide a route to the peer address.
On Linux, inspect active TCP connections:
ss -ntp | grep ':179' For deeper diagnosis, capture traffic and inspect the source and destination IP addresses.
If the router is sourcing BGP traffic from the wrong interface, the peer may receive packets from an address that is not configured as a valid neighbor.
Cisco explains this issue in its BGP Neighborship Connection Troubleshooting Guide.
External BGP normally expects directly connected neighbors.
By default, the TTL behavior for ordinary eBGP peering is designed for directly connected peers.
If the routers establish a session using loopbacks or through one or more intermediate routers, the default TTL may be insufficient.
This can prevent the TCP session from reaching the remote BGP peer.
Router A Intermediate Router Router B
| | |
|--------------------------|---------------------------|
| |
Loopback0 Loopback0
10.1.1.1 10.2.2.2
AS 65001 AS 65002 The routers need:
router bgp 65001
neighbor 10.2.2.2 remote-as 65002
neighbor 10.2.2.2 update-source Loopback0
neighbor 10.2.2.2 ebgp-multihop 2 router bgp 65002
neighbor 10.1.1.1 remote-as 65001
neighbor 10.1.1.1 update-source Loopback0
neighbor 10.1.1.1 ebgp-multihop 2 The value 2 is an illustrative TTL setting for a suitable topology. Choose the value based on the actual number of hops and the intended network design.
Also make sure that the remote loopback is reachable through an appropriate route.
Do not enable eBGP multihop automatically for directly connected eBGP peers.
Use it only when the peer is not directly connected and the routing design requires it.
See Cisco’s eBGP Multihop Troubleshooting Example.
BGP sessions can use TCP MD5 authentication to protect the TCP connection between configured peers.
If the authentication password does not match, the TCP connection may fail even when routing and firewall configuration appear correct.
Common problems include:
Check the BGP neighbor configuration on both routers.
Example Cisco configuration:
router bgp 65001
neighbor 192.0.2.2 password MySecureBGPKey The remote peer must be configured with the corresponding secret.
For production environments, use a secure secret-management process rather than placing passwords in shared documents or scripts.
Cisco documents authentication-related TCP errors such as BADAUTH in its BGP Troubleshooting Guide.
When a BGP session successfully establishes TCP connectivity but does not progress to Established, examine the OPEN and KEEPALIVE exchange.
A router in OpenSent has sent a BGP OPEN message and is waiting for the remote peer’s OPEN message.
Investigate:
A mismatched AS number can result in a BGP NOTIFICATION and a return to Idle.
Inspect the received NOTIFICATION code and subcode when the platform exposes them.
A router in OpenConfirm waits for a KEEPALIVE or NOTIFICATION message.
If the session does not progress, investigate:
On Linux:
sudo tcpdump -ni eth0 'tcp port 179' In Wireshark:
tcp.port == 179 Look for:
This helps separate transport failures from BGP protocol negotiation failures.
A BGP session may establish successfully but then repeatedly disconnect.
One common notification is:
%BGP-3-NOTIFICATION:
sent to neighbor 192.0.2.2 4/0
(hold time expired) This means the router did not receive or process a valid KEEPALIVE or UPDATE message before the Hold Timer expired.
Possible causes include:
On Cisco:
show interfaces Look for:
show ip bgp summary A short or frequently resetting Up/Down timer may indicate session instability.
show processes cpu sorted High CPU utilization can affect the ability to process BGP control-plane traffic and maintain session timers.
Check the route to the peer:
show ip route 192.0.2.2 On platforms that support it, inspect the TCP connection and BGP event logs.
Inspect the negotiated Hold Time:
show ip bgp neighbors 192.0.2.2 Both peers negotiate compatible timer values during session establishment.
Do not simply increase the Hold Time to hide a persistent packet loss or control-plane issue. Identify the underlying cause first.
An established BGP session does not guarantee that any prefixes will be exchanged.
A neighbor may be fully operational but display zero received prefixes.
Example:
Neighbor AS State/PfxRcd
192.0.2.2 65002 0 Investigate the address family and route policies.
On Cisco IOS:
show running-config | section router bgp With address-family-based configuration, a neighbor may be configured globally but not activated under the intended address family.
Example:
router bgp 65001
neighbor 192.0.2.2 remote-as 65002
address-family ipv4 unicast
neighbor 192.0.2.2 activate The required configuration depends on the Cisco platform and software version.
On Cisco, inspect:
show ip bgp neighbors 192.0.2.2 advertised-routes This shows routes advertised to the peer, subject to platform behavior and configuration.
Where supported:
show ip bgp neighbors 192.0.2.2 routes Check whether routes are received but filtered or rejected before being installed in the routing table.
show running-config | section router bgp Look for:
A BGP session can remain Established even when routing policy rejects every received route.
A Cisco network statement normally requires the corresponding prefix to exist in the local routing table with a matching prefix.
Example:
router bgp 65001
address-family ipv4 unicast
network 10.10.10.0 mask 255.255.255.0 If the specified prefix does not exist in the routing table as required, the network may not be originated into BGP.
These commands provide a practical starting point for diagnosing neighbor problems.
| Command | Purpose |
|---|---|
show ip bgp summary | Inspect BGP neighbor states |
show ip bgp neighbors | Detailed peer information |
show ip bgp | Inspect the BGP table |
show ip route | Verify routes to peers and prefixes |
show ip interface brief | Check interface status |
show running-config | Inspect BGP configuration |
show logging | Review BGP errors and notifications |
show access-lists | Inspect ACL behavior |
show processes cpu sorted | Review CPU utilization |
Enter the FRR virtual terminal:
sudo vtysh Check BGP neighbors:
show bgp summary Inspect neighbor details:
show bgp neighbors 192.0.2.2 Inspect the BGP routing table:
show bgp ipv4 unicast Check Linux routes:
ip route show Inspect TCP connections:
ss -ntp | grep ':179' Inspect packet traffic:
sudo tcpdump -ni eth0 'tcp port 179' Check BGP sessions:
show bgp summary Inspect a specific peer:
show bgp neighbor 192.0.2.2 Review the configuration:
show configuration protocols bgp Check routes advertised to a peer:
show route advertising-protocol bgp 192.0.2.2 Inspect routes received from a peer:
show route receive-protocol bgp 192.0.2.2 The exact command syntax and available output vary by platform and software release.
Use the observed state or symptom to select the next diagnostic step.
| Symptom | First Investigation |
|---|---|
| Neighbor remains Idle | Administrative shutdown, configuration and BGP logs |
| Neighbor remains Connect | TCP handshake, route to peer and port 179 |
| Neighbor remains Active | Firewall, TCP connectivity, source address and multihop |
| Neighbor reaches OpenSent then fails | OPEN message, AS number and peer parameters |
| Neighbor remains OpenConfirm | KEEPALIVE exchange and session stability |
| Neighbor repeatedly disconnects | Hold Timer, packet loss, CPU and interface errors |
| Session Established with zero prefixes | Address-family activation and route policies |
| Routes received but not installed | BGP best-path selection and routing table |
| eBGP over loopbacks fails | Update-source, peer reachability and eBGP multihop |
| Authentication errors | TCP authentication configuration |
Stable BGP sessions depend on consistent peer configuration and reliable transport connectivity.
Follow these practices:
Use explicit peer addresses. Make sure both routers use the correct neighbor IP.
Verify AS numbers on both sides. An incorrect remote AS can prevent OPEN negotiation.
Check routing before BGP. A router must be able to reach its configured peer address before the BGP session can establish.
Protect TCP port 179. Restrict BGP connections to authorized peer addresses instead of exposing the service broadly.
Use update-source consistently. When peering through loopbacks, configure the intended source interface on both routers.
Configure eBGP multihop only when necessary. Use it when eBGP peers are not directly connected and the topology requires it.
Keep authentication consistent. Make sure both peers use compatible authentication settings.
Monitor session uptime. Frequent BGP resets can indicate transport instability or control-plane problems.
Separate session problems from route problems. An Established session with no prefixes requires policy and address-family investigation, not TCP troubleshooting.
Avoid unnecessary resets. Repeatedly clearing BGP sessions can interrupt routing and make troubleshooting harder.
Document peer parameters. Maintain a record of peer IP, local AS, remote AS, source interface, address families, timers, and authentication policy.
A BGP neighbor stuck in Active is frequently experiencing a TCP connectivity problem. Check whether the remote peer is reachable, TCP port 179 is permitted, the correct source address is used, and the remote BGP process is listening.
Active means the router is attempting to establish the TCP connection with its peer. Established means the BGP session is operational and the routers can exchange routing updates.
BGP uses TCP, not UDP. The standard BGP listening port is TCP 179, as specified in RFC 4271.
The Connect state means BGP is waiting for the TCP connection to complete. Investigate peer reachability, TCP port 179, routing, firewall policy, and the configured source address.
An AS mismatch occurs when a router’s configured remote AS does not match the AS number presented by its peer in the BGP OPEN message. Correct the neighbor configuration on the affected router.
The update-source command specifies which local interface address is used to establish the BGP session. It is commonly used with loopback-based iBGP and eBGP peering.
Use eBGP multihop when external BGP peers are not directly connected and the connection must traverse intermediate routers. The peer addresses must also be reachable through appropriate routes.
Yes. A BGP session can be Established while receiving zero prefixes. Check address-family activation, inbound filtering, route advertisements, and remote routing policy.
Use:
show ip bgp summary For more information about an individual neighbor:
show ip bgp neighbors 192.0.2.2 BGP uses TCP port 179 for incoming connections. Firewalls and ACLs must allow the intended peer connections while restricting access to authorized routers.
BGP neighbor troubleshooting is much easier when the session state is used to identify the failing stage of the connection process.
An Active neighbor often requires investigation of TCP connectivity. A session stuck in Connect needs routing and transport checks. An OpenSent failure requires closer inspection of the BGP OPEN exchange, including AS numbers and negotiated parameters.
Once the session reaches Established, troubleshooting should move to address families, prefix advertisements, route filtering, and path selection.
Start with show ip bgp summary, verify reachability to the peer, test TCP port 179, and compare the BGP configuration on both routers.
This structured approach helps identify the actual cause of BGP session failures without introducing unnecessary changes to production routing infrastructure.
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "Why is my BGP neighbor stuck in Active?",
"acceptedAnswer": {
"@type": "Answer",
"text": "A BGP neighbor stuck in Active is frequently experiencing a TCP connectivity problem. Check whether the remote peer is reachable, TCP port 179 is permitted, the correct source address is used, and the remote BGP process is listening."
}
},
{
"@type": "Question",
"name": "Does BGP use TCP or UDP?",
"acceptedAnswer": {
"@type": "Answer",
"text": "BGP uses TCP, not UDP. The standard BGP listening port is TCP 179, as specified in RFC 4271."
}
},
{
"@type": "Question",
"name": "Why does a BGP session remain in Connect?",
"acceptedAnswer": {
"@type": "Answer",
"text": "The Connect state means BGP is waiting for the TCP connection to complete. Investigate peer reachability, TCP port 179, routing, firewall policy, and the configured source address."
}
},
{
"@type": "Question",
"name": "What causes a BGP AS mismatch?",
"acceptedAnswer": {
"@type": "Answer",
"text": "An AS mismatch occurs when a router's configured remote AS does not match the AS number presented by its peer in the BGP OPEN message."
}
},
{
"@type": "Question",
"name": "What does update-source do in BGP?",
"acceptedAnswer": {
"@type": "Answer",
"text": "The update-source command specifies which local interface address is used to establish the BGP session. It is commonly used with loopback-based iBGP and eBGP peering."
}
},
{
"@type": "Question",
"name": "When should I use eBGP multihop?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Use eBGP multihop when external BGP peers are not directly connected and the connection must traverse intermediate routers. The peer addresses must also be reachable through appropriate routes."
}
},
{
"@type": "Question",
"name": "Can BGP be Established without receiving any routes?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes. A BGP session can be Established while receiving zero prefixes. Check address-family activation, inbound filtering, route advertisements, and remote routing policy."
}
}
]
} Introduction Border Gateway Protocol (BGP) is the routing protocol used to exchange network reachability information…
Introduction A Linux server can experience connection failures even when its network interface is working…
Introduction TCP retransmissions are an important indicator of network reliability and performance. When a Linux…
Open Shortest Path First (OSPF) is a link-state routing protocol widely used in enterprise networks…
Group Policy is one of the most important management features in Windows Server Active Directory…
Windows DNS servers play an essential role in Active Directory environments, allowing computers, servers, applications,…
View Comments