show ip bgp neighbors
Displays detailed information about BGP neighbor sessions, including state, timers, and advertised/received prefixes, used to verify BGP peering and troubleshoot neighbor relationships.
Definition: show ip bgp neighbors is a Cisco IOS privileged exec command. Displays detailed information about BGP neighbor sessions, including state, timers, and advertised/received prefixes, used to verify BGP peering and troubleshoot neighbor relationships.
Overview
The 'show ip bgp neighbors' command is a cornerstone for any network engineer working with Border Gateway Protocol (BGP). It provides a detailed view of each BGP neighbor session, including the current state of the peering, timers, capabilities, and the number of prefixes advertised and received. This command is essential for verifying that BGP peering is established correctly, troubleshooting neighbor relationship issues, and monitoring the health of BGP sessions.
BGP is the routing protocol that powers the internet, used to exchange routing information between autonomous systems (ASes). Unlike interior gateway protocols (IGPs) like OSPF or EIGRP, BGP is a path-vector protocol that makes routing decisions based on paths, policies, and rules configured by network administrators. When you need to check if a BGP neighbor is up, why it's not forming, or what routes are being exchanged, 'show ip bgp neighbors' is your first go-to command.
Alternatives like 'show ip bgp summary' give a high-level overview, but for deep dive into a specific neighbor, this command is unmatched. In a troubleshooting workflow, you typically start with 'show ip bgp summary' to see the state of all neighbors, then drill down with 'show ip bgp neighbors <neighbor-ip>' for a specific peer. The command does not affect the running configuration; it is a read-only show command.
However, be aware that on some platforms with large BGP tables, the output can be extensive and may be buffered or paginated. Privilege level 1 (user EXEC) is sufficient to run this command, but some fields (like the BGP table version) may require higher privileges. Understanding this command is critical for CCNA and CCNP candidates as BGP is a major topic in the CCNP ENCOR and ENARSI exams, and it is widely used in service provider and enterprise networks.
show ip bgp neighborsWhen to Use This Command
- Verify that a BGP neighbor is in the Established state after configuration.
- Check the number of prefixes received from a neighbor to ensure route exchange is working.
- Troubleshoot BGP session flapping by examining hold time and keepalive counters.
- Inspect BGP version and capabilities negotiated with a neighbor.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| neighbor-ip | A.B.C.D | The IP address of the BGP neighbor. If specified, displays detailed information only for that neighbor. If omitted, displays summary information for all neighbors. Common mistake: using the wrong IP address (e.g., using the local interface IP instead of the neighbor's IP). |
Command Examples
Basic BGP neighbor summary
show ip bgp neighborsBGP neighbor is 10.1.1.2, remote AS 65002, external link
BGP version 4, remote router ID 2.2.2.2
BGP state = Established, up for 1w2d
Last read 00:00:15, last write 00:00:10, hold time is 180, keepalive interval is 60 seconds
Neighbor sessions:
1 active, is the multisession capable
Neighbor capabilities:
Route refresh: advertised and received(new)
Four-octets ASN Capability: advertised and received
Address family IPv4 Unicast: advertised and received
Received 1500 messages, 0 notifications, 0 in queue
Sent 1200 messages, 0 notifications, 0 in queue
Route refresh request: received 0, sent 0
Minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
Session: 10.1.1.2
BGP table version 100, neighbor version 100/0
Output queue size: 0
Index 0, Advertised bit 0
1 update-group member
Slow-peer detection is disabled
Slow-peer split-update-group dynamic is disabled
Sent Received
Prefix activity: --- ---
Prefixes Current: 5 8
Prefixes Total: 5 8
Implicit Withdraw: 0 0
Explicit Withdraw: 0 0
Used as bestpath/nonbestpath: 5/0 8/0
Number of NLRIs in the update sent: max 0, min 0
Last End-of-RIB received: yes
Last End-of-RIB sent: yes
Last notification sent: OPEN Message/Unsupported Capability (0x02/0x06)
Last notification received: none
The output shows the neighbor IP (10.1.1.2) and remote AS (65002). 'BGP state = Established' confirms the session is up. 'up for 1w2d' indicates uptime. 'hold time is 180, keepalive interval is 60' are timer values. 'Prefixes Current: 5 sent, 8 received' shows the number of prefixes exchanged. 'Last notification sent' indicates a past error (unsupported capability) but session is now up.
BGP neighbor not established
show ip bgp neighbors 10.1.1.2BGP neighbor is 10.1.1.2, remote AS 65002, external link
BGP version 4, remote router ID 0.0.0.0
BGP state = Active
Last read 00:00:45, last write 00:00:40, hold time is 180, keepalive interval is 60 seconds
Neighbor sessions:
1 active, is the multisession capable
Neighbor capabilities:
Route refresh: advertised and received(new)
Four-octets ASN Capability: advertised and received
Address family IPv4 Unicast: advertised and received
Received 0 messages, 0 notifications, 0 in queue
Sent 10 messages, 0 notifications, 0 in queue
Route refresh request: received 0, sent 0
Minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
Session: 10.1.1.2
BGP table version 1, neighbor version 0
Output queue size: 0
Index 0, Advertised bit 0
0 update-group member
Slow-peer detection is disabled
Slow-peer split-update-group dynamic is disabled
Sent Received
Prefix activity: --- ---
Prefixes Current: 0 0
Prefixes Total: 0 0
Implicit Withdraw: 0 0
Explicit Withdraw: 0 0
Used as bestpath/nonbestpath: 0/0 0/0
Number of NLRIs in the update sent: max 0, min 0
Last End-of-RIB received: no
Last End-of-RIB sent: no
Last notification sent: none
Last notification received: none
The state is 'Active', meaning the router is trying to establish a TCP connection. 'remote router ID 0.0.0.0' indicates no router ID received. 'Received 0 messages' confirms no updates. This suggests a connectivity issue or misconfiguration (e.g., wrong neighbor IP or AS).
Understanding the Output
The 'show ip bgp neighbors' output provides a wealth of information about each BGP peer. The first line shows the neighbor IP and remote AS, and whether it's an eBGP (external) or iBGP (internal) link. The 'BGP state' field is critical: 'Idle' means no connection attempt, 'Connect' means TCP connection in progress, 'Active' means TCP connection failed or waiting, 'OpenSent'/'OpenConfirm' means BGP messages exchanged, and 'Established' means the session is fully up.
The 'up for' duration indicates stability. Timer values (hold time, keepalive) should match between peers; mismatches cause session drops. The 'Prefix activity' section shows how many prefixes are currently sent and received; a sudden drop may indicate a route withdrawal or filter issue.
'Last notification' fields record any errors; common ones include 'OPEN Message/Unsupported Capability' or 'UPDATE Message/Malformed Attribute'. The 'BGP table version' and 'neighbor version' track synchronization; if they diverge, updates are pending. The 'Output queue size' should be 0; non-zero indicates backpressure.
In a healthy network, all neighbors should be 'Established' with consistent prefix counts and no recent notifications.
Configuration Scenarios
Establish eBGP peering between two routers in different autonomous systems
Two routers, R1 (AS 65001) and R2 (AS 65002), are directly connected via a /30 subnet. The goal is to establish eBGP peering and verify the session is up.
Topology
R1(Gi0/0)---10.0.12.0/30---(Gi0/0)R2Steps
- 1.Step 1: On R1, enter global configuration mode: R1# configure terminal
- 2.Step 2: Configure BGP process and specify the local AS: R1(config)# router bgp 65001
- 3.Step 3: Specify the neighbor IP and remote AS: R1(config-router)# neighbor 10.0.12.2 remote-as 65002
- 4.Step 4: (Optional) Configure the update source interface if needed: R1(config-router)# neighbor 10.0.12.2 update-source GigabitEthernet0/0
- 5.Step 5: Repeat similar configuration on R2 with AS 65002 and neighbor 10.0.12.1
- 6.Step 6: Exit configuration mode and verify: R1(config-router)# end
! R1 configuration router bgp 65001 neighbor 10.0.12.2 remote-as 65002 neighbor 10.0.12.2 update-source GigabitEthernet0/0 ! ! R2 configuration router bgp 65002 neighbor 10.0.12.1 remote-as 65001 neighbor 10.0.12.1 update-source GigabitEthernet0/0
Verify: Use 'show ip bgp neighbors 10.0.12.2' on R1. Look for 'BGP state = Established' and 'Neighbor is up' in the output. The BGP state should be 1 (Idle) initially, then 2 (Connect), 3 (Active), 4 (OpenSent), 5 (OpenConfirm), and finally 6 (Established).
Watch out: Forgetting to specify the update-source when the neighbor IP is not the same as the outgoing interface IP. This can cause the TCP connection to fail because the source IP of the BGP packets may not match what the neighbor expects.
Troubleshoot a BGP neighbor that is stuck in Active state
A BGP neighbor between R1 (AS 65001) and R3 (AS 65003) is not establishing. The neighbor IP is 192.168.1.2, but the session remains in Active state. The goal is to diagnose and fix the issue.
Topology
R1(Gi0/0)---10.0.13.0/30---(Gi0/0)R3Steps
- 1.Step 1: Check the BGP neighbor state: R1# show ip bgp neighbors 192.168.1.2
- 2.Step 2: Notice the state is 'Active' and check the 'Last reset' field for clues.
- 3.Step 3: Verify IP connectivity to the neighbor: R1# ping 192.168.1.2
- 4.Step 4: If ping fails, check the routing table and interface status: R1# show ip route 192.168.1.2
- 5.Step 5: Verify that the neighbor is configured with the correct remote AS: R1# show run | section router bgp
- 6.Step 6: Check if an access list or firewall is blocking TCP port 179: R1# show access-lists
- 7.Step 7: If all else fails, enable BGP debugging: R1# debug ip bgp 192.168.1.2 updates
! On R1, ensure correct configuration: router bgp 65001 neighbor 192.168.1.2 remote-as 65003 neighbor 192.168.1.2 update-source GigabitEthernet0/0 ! ! On R3, ensure correct configuration: router bgp 65003 neighbor 10.0.13.1 remote-as 65001 neighbor 10.0.13.1 update-source GigabitEthernet0/0
Verify: After fixing the issue, 'show ip bgp neighbors 192.168.1.2' should show 'BGP state = Established'. Also check 'show ip bgp summary' to see the state of all neighbors.
Watch out: A common mistake is misconfiguring the remote AS number. If the remote AS does not match, the neighbor will stay in Active state. Also, ensure that the neighbor IP is reachable and that there is no mismatch in the update-source interface.
Troubleshooting with This Command
When troubleshooting BGP neighbor issues, 'show ip bgp neighbors' is your primary diagnostic tool. A healthy output will show 'BGP state = Established', 'Neighbor is up', and timers like 'Hold time is 180, keepalive interval is 60 seconds'. The 'BGP version 4' and 'Remote router ID' fields should also be present.
Key fields to focus on include: 'BGP state' (the current state of the session), 'Last reset' (reason and time since last reset), 'Connections established' and 'dropped' (counters for session stability), 'Prefixes received' and 'advertised' (to verify route exchange), and 'TCP connection state' (should be ESTABLISHED). Common symptoms: If the state is 'Idle', it means BGP is not trying to connect (often due to administrative shutdown or no route to neighbor). 'Active' means BGP is actively trying to initiate a TCP connection but failing (common causes: wrong remote AS, ACL blocking TCP 179, unreachable neighbor).
'OpenSent' or 'OpenConfirm' indicates a problem during the BGP open message exchange (e.g., mismatched AS numbers, hold timer mismatch). A step-by-step diagnostic flow: 1) Check 'show ip bgp summary' to see all neighbors and their states. 2) For a problematic neighbor, run 'show ip bgp neighbors <ip>' and note the state. 3) Check 'Last reset' for reason (e.g., 'BGP Notification sent', 'Peer closed the session'). 4) Verify IP connectivity with ping and traceroute. 5) Check TCP port 179 reachability (telnet to neighbor's IP port 179). 6) Verify BGP configuration on both sides (remote AS, update-source, password if used). 7) Check for any inbound/outbound route maps or prefix lists that might be filtering. 8) Use 'debug ip bgp' with caution to see real-time updates. Correlate with 'show ip bgp' to see the BGP table and 'show ip route bgp' to see installed routes.
Also, 'show tcp brief' can show the TCP connection state for the BGP session. Remember that BGP uses TCP port 179, so any network issues affecting TCP will impact BGP. In large networks, BGP sessions can flap due to route flapping or policy changes; the 'show ip bgp neighbors' output will show counters for 'Prefixes received' and 'advertised' that can indicate instability if they change rapidly.
CCNA Exam Tips
CCNA exam may ask you to identify the BGP state from output; know the six states (Idle, Connect, Active, OpenSent, OpenConfirm, Established).
Be able to determine if a BGP session is up by looking for 'Established' and the uptime field.
The 'hold time' and 'keepalive' timers are often tested; default hold time is 180 seconds, keepalive 60 seconds.
If the state is 'Active', common causes are incorrect neighbor IP, wrong AS number, or ACL blocking TCP port 179.
Common Mistakes
Mistake 1: Confusing 'Active' state with 'Established' — Active means the session is down, not up.
Mistake 2: Ignoring the 'Last notification' field; it often contains the reason for a previous session reset.
Mistake 3: Assuming all neighbors should have the same prefix counts; differences are normal if filters or policies are applied.
show ip bgp neighbors vs show ip bgp summary
Both `show ip bgp neighbors` and `show ip bgp summary` are used to inspect BGP peering status, but they differ in level of detail. They are often confused because both display neighbor state and prefix counts, yet one provides per-neighbor granularity while the other gives an aggregated overview.
| Aspect | show ip bgp neighbors | show ip bgp summary |
|---|---|---|
| Level of Detail | Per-neighbor breakdown: timers, capabilities, prefixes | One line per neighbor: state, table version, prefix counts |
| Output Verbosity | Very verbose; multiple lines per neighbor | Concise; fits many neighbors on screen |
| Typical Use | Troubleshooting specific neighbor issues (e.g., flapping, mismatched AS) | Quick health check of all neighbors and route table status |
| Key Fields Shown | BGP state, hold/keepalive timers, NLRI, received/advertised prefixes per address family | Neighbor ID, AS, state, uptime, received/active prefixes |
| Performance Impact | Higher CPU if many neighbors or large table; use sparingly | Lightweight; safe for routine monitoring |
Use `show ip bgp neighbors` when you need to investigate a specific BGP neighbor's detailed session parameters, including timers, capabilities, and per-address-family prefix counts.
Use `show ip bgp summary` when you want a quick overview of all BGP neighbors' states and prefix counts to verify overall peering health and routing table convergence.
Platform Notes
In IOS-XE (e.g., Catalyst 9000 switches, ASR 1000), the command syntax and output are largely identical to classic IOS. However, some newer versions may include additional fields like 'Multisession' or 'TCP path MTU'. On NX-OS (e.g., Nexus 9000), the equivalent command is 'show bgp neighbors' (without 'ip') and the output format is different, with fields like 'BGP state' and 'Neighbor address'.
For example, 'show bgp neighbors 10.0.12.2' on NX-OS. Also, NX-OS uses 'router bgp <asn>' with different subcommands. On ASA firewalls, BGP is not supported in classic ASA code; however, in ASA with FirePOWER services, BGP may be available via the FXOS.
For IOS-XR (e.g., ASR 9000, CRS), the command is 'show bgp neighbors' (similar to NX-OS) and the output is more detailed, including fields like 'Neighbor is up for' and 'Received prefixes'. In IOS versions 12.x and 15.x, the output is similar, but 15.x added support for IPv6 BGP and additional capabilities. In 16.x (IOS-XE), the output may include 'BGP dynamic neighbors' if configured.
Always check the specific platform documentation, as some fields may vary. For example, on older IOS 12.4, the 'show ip bgp neighbors' output might not include 'Multisession' or 'TCP options' fields that appear in later versions.
Related Commands
clear ip bgp *
Resets all BGP sessions and clears the BGP routing table, forcing a complete re-advertisement and re-learning of all BGP routes from all neighbors.
show ip bgp
Displays the BGP routing table, showing learned BGP routes and their attributes, used for troubleshooting BGP path selection and verifying route advertisement.
show ip bgp summary
Displays a summary of the BGP neighbor status and prefix counts, used to quickly verify BGP peering and routing table health.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions