show bgp ipv4 unicast neighbors
Displays detailed information about BGP IPv4 unicast neighbors, including session state, capabilities, and statistics.
Overview
The 'show bgp ipv4 unicast neighbors' command is a fundamental troubleshooting and verification tool for BGP in Cisco IOS-XR. It provides a comprehensive view of the BGP peering session, including session state, timers, capabilities, message statistics, and prefix exchange details. BGP (Border Gateway Protocol) is the de facto exterior gateway protocol used to exchange routing information between autonomous systems (AS). In IOS-XR, BGP is highly scalable and supports multiple address families, with IPv4 unicast being the most common. This command is essential for verifying that BGP neighbors are correctly configured and that routes are being exchanged as expected. Network engineers use it during initial configuration to confirm peering comes up, during troubleshooting to identify why a session is down or flapping, and during monitoring to ensure route propagation is healthy. On IOS-XR, the command syntax requires specifying the address family (e.g., 'ipv4 unicast') because BGP is address-family aware. The output is detailed and includes fields like BGP state, hold time, keepalive interval, neighbor capabilities (e.g., route refresh, four-octet ASN), message statistics, and per-address-family information such as table version, prefix counts, and soft reconfiguration status. Understanding this output is critical for CCNP and CCIE candidates, as BGP is a major topic. The command can be extended with keywords like 'detail', 'advertised-routes', 'received-routes', and 'routes' to drill down into specific aspects. In troubleshooting workflows, it is often the first command used after 'show bgp summary' to investigate a specific neighbor.
show bgp ipv4 unicast neighbors [ip-address] [detail] [advertised-routes] [received-routes] [routes] [statistics]When to Use This Command
- Verify BGP neighbor session state and uptime after configuration changes.
- Troubleshoot BGP peering issues such as flapping or stuck in Idle state.
- Check advertised and received prefixes to ensure route exchange is correct.
- Monitor BGP timers and message statistics for performance analysis.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| ip-address | A.B.C.D | IP address of the BGP neighbor. If omitted, displays all neighbors. Specifying a neighbor filters output to that peer. |
| detail | detail | Provides additional per-address-family information, including table version, prefix counts, and soft reconfiguration status. |
| advertised-routes | advertised-routes | Shows the routes that the local router has advertised to the specified neighbor. Useful for verifying outbound route policy. |
| received-routes | received-routes | Shows all routes received from the neighbor, including those not installed due to policy. Requires soft reconfiguration or route refresh. |
| routes | routes | Displays routes learned from the neighbor that are installed in the BGP table. Equivalent to 'show bgp ipv4 unicast neighbors <ip> routes'. |
| statistics | statistics | Shows only the message statistics and session counters, omitting other details. Useful for quick health checks. |
Command Examples
Basic Neighbor Information
show bgp ipv4 unicast neighbors 10.0.0.2BGP neighbor is 10.0.0.2, remote AS 65002, internal link
BGP version 4, remote router ID 2.2.2.2
BGP state = Established, up for 1w2d
Last read 00:00:10, last write 00:00:12
Hold time is 90, keepalive interval is 30 seconds
Configured hold time: 90, keepalive: 30, min acceptable hold time: 3
Neighbor capabilities:
Route refresh: advertised and received (new)
Four-octets ASN Capability: advertised and received
Address family IPv4 Unicast: advertised and received
Message statistics:
Sent: 12345, Received: 12340
Connections established 2; dropped 1
Last reset 1w2d, due to BGP Notification sent (Cease)Shows neighbor 10.0.0.2 is in Established state for 1 week 2 days. Hold time and keepalive are standard. Message counts are balanced. One reset occurred due to a Cease notification.
Detailed Neighbor Information
show bgp ipv4 unicast neighbors 10.0.0.2 detailBGP neighbor is 10.0.0.2, remote AS 65002, internal link
BGP version 4, remote router ID 2.2.2.2
BGP state = Established, up for 1w2d
Last read 00:00:10, last write 00:00:12
Hold time is 90, keepalive interval is 30 seconds
Configured hold time: 90, keepalive: 30, min acceptable hold time: 3
Neighbor capabilities:
Route refresh: advertised and received (new)
Four-octets ASN Capability: advertised and received
Address family IPv4 Unicast: advertised and received
Message statistics:
Sent: 12345, Received: 12340
Connections established 2; dropped 1
Last reset 1w2d, due to BGP Notification sent (Cease)
For address family: IPv4 Unicast
BGP table version 100, neighbor version 100
Index 1, Offset 0, Mask 0x2
Inbound soft reconfiguration allowed
Prefixes accepted 500, prefixes installed 500
Best paths 500, multipath 0
Advertised prefixes: 400
Community attribute sent to this neighbor
Private AS number removed from updates to this neighborDetail adds address family info: table versions match (100), 500 prefixes accepted and installed, 400 advertised. Soft reconfiguration is allowed.
Advertised Routes
show bgp ipv4 unicast neighbors 10.0.0.2 advertised-routesBGP neighbor is 10.0.0.2, remote AS 65002, internal link Network Next Hop Metric LocPrf Weight Path *> 192.168.1.0/24 10.0.0.1 0 100 0 i *> 192.168.2.0/24 10.0.0.1 0 100 0 i Total number of prefixes 2
Lists prefixes advertised to neighbor. The '*> ' indicates best path. Next hop is local interface. Metric and local preference shown.
Understanding the Output
The output begins with neighbor IP and remote AS, indicating whether it's internal (iBGP) or external (eBGP). The BGP state is critical: 'Established' means the session is up; other states like 'Idle', 'Active', 'OpenSent', 'OpenConfirm' indicate issues. Uptime shows how long the session has been stable. Hold time and keepalive interval should match between peers; mismatches can cause flapping. Message statistics show sent/received counts; large discrepancies may indicate packet loss. Connections established and dropped indicate session stability; frequent resets are problematic. The 'Last reset' reason helps diagnose issues (e.g., 'BGP Notification sent (Cease)' indicates an error). In detail output, address family info shows table version (should match neighbor version), number of prefixes accepted/installed/advertised. Healthy values: state Established, uptime long, message counts balanced, prefixes consistent. Problem values: state not Established, frequent resets, version mismatch, or prefix count zero.
Configuration Scenarios
Verifying eBGP Peering
Two routers in different ASes are configured for eBGP peering. Need to confirm session is up and routes are exchanged.
Topology
R1 (AS 65001) --- 10.0.0.0/30 --- R2 (AS 65002)Steps
- 1.Configure BGP on R1 and R2 with neighbor statements.
- 2.Use 'show bgp ipv4 unicast neighbors 10.0.0.2' on R1 to check state.
- 3.If state is not Established, check timers and IP connectivity.
! On R1 router bgp 65001 neighbor 10.0.0.2 remote-as 65002 address-family ipv4 unicast neighbor 10.0.0.2 activate !
Verify: Verify state is Established and prefixes are exchanged using 'show bgp ipv4 unicast neighbors 10.0.0.2 advertised-routes' and 'received-routes'.
Watch out: Ensure the neighbor's remote-as matches the actual AS of the peer; otherwise, session will not establish.
Troubleshooting BGP Flapping
A BGP session is flapping due to a hold time mismatch. Need to identify and correct the issue.
Topology
R1 (AS 65001) --- R2 (AS 65002)Steps
- 1.On R1, run 'show bgp ipv4 unicast neighbors 10.0.0.2' and note the hold time and keepalive.
- 2.Compare with R2's configuration; they must match.
- 3.Adjust timers on one side to match.
! On R1, set timers to match R2 router bgp 65001 neighbor 10.0.0.2 timers 10 30 !
Verify: After change, verify session stabilizes with 'show bgp ipv4 unicast neighbors 10.0.0.2' and check uptime increases.
Watch out: The 'timers' command sets keepalive and hold time; hold time must be at least 3 seconds.
Troubleshooting with This Command
When troubleshooting BGP issues on Cisco IOS-XR, the 'show bgp ipv4 unicast neighbors' command is indispensable. Start by checking the BGP state: if it's not 'Established', the session is down. Common states include 'Idle' (no connection attempt), 'Active' (trying to connect), 'OpenSent' (waiting for open message), and 'OpenConfirm' (waiting for keepalive). If the state is 'Idle', check if the neighbor is configured correctly (remote-as, update-source) and if there is IP reachability (ping). If 'Active', the router is trying to connect but not receiving a response; verify ACLs, firewall, and that the neighbor is configured to accept the connection. The 'Last reset' field provides the reason for the last session reset; common reasons include 'BGP Notification sent (Cease)' (often due to configuration change or error), 'Peer de-configured', or 'Hold time expired'. Message statistics can indicate problems: if 'Received' is much lower than 'Sent', the neighbor may not be sending updates or there is packet loss. The 'Connections established' and 'dropped' counters show session stability; frequent drops indicate flapping. In the detail output, check the table version: the neighbor version should match the local BGP table version; if not, the neighbor may be out of sync, possibly due to slow processing or route policy. Prefix counts: 'Prefixes accepted' should match 'Prefixes installed' unless inbound policy filters some routes. 'Advertised prefixes' should be non-zero if you have routes to send. If 'advertised-routes' shows zero, check outbound route policy or network statements. Soft reconfiguration is useful for debugging received routes without resetting the session; if enabled, 'received-routes' will show all routes even after policy changes. On IOS-XR, you can also use 'show bgp ipv4 unicast neighbors <ip> received-routes' to see what the neighbor sent, which helps identify if the neighbor is sending expected prefixes. Always correlate with 'show bgp summary' for a quick overview of all neighbors.
CCNA Exam Tips
Remember the BGP state machine: Idle, Connect, Active, OpenSent, OpenConfirm, Established.
Know that 'show bgp ipv4 unicast neighbors' is used to verify peering; 'show bgp summary' gives a quick overview.
Be able to interpret 'Last reset' reasons like 'BGP Notification sent (Cease)' or 'Peer de-configured'.
Common Mistakes
Confusing 'advertised-routes' with 'received-routes'; the former shows what the local router sends, the latter what it receives.
Forgetting to specify the address family (ipv4 unicast) on IOS-XR; the command without it may not work.
Misinterpreting 'Prefixes accepted' vs 'Prefixes installed'; accepted are all received, installed are those used in routing table.
Platform Notes
On Cisco IOS-XR, the BGP implementation is modular and address-family aware, requiring explicit address family specification in commands. Unlike classic IOS, where 'show ip bgp neighbors' works, IOS-XR uses 'show bgp ipv4 unicast neighbors'. The output format is similar but includes additional fields like 'min acceptable hold time'. IOS-XR also supports advanced features like BGP multipath, additional path, and flow-tag, which may appear in output. For equivalent commands on other platforms: on Juniper JunOS, 'show bgp neighbor <ip>' provides similar info; on Arista EOS, 'show bgp neighbors <ip>'. On IOS-XR, the command can be used with 'detail' to get per-address-family info, which is not available in classic IOS without separate commands. Version differences: In IOS-XR 6.x and later, the output includes 'BGP table version' per address family. For troubleshooting, IOS-XR also supports 'show bgp ipv4 unicast neighbors <ip> advertised-routes' and 'received-routes' similar to IOS, but soft reconfiguration must be enabled to use 'received-routes' without resetting the session. The 'statistics' keyword is useful for quick health checks without cluttering output. Overall, IOS-XR's BGP commands are more structured and consistent across address families.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions