To check Border Gateway Protocol (BGP) routes, you typically use command-line interface (CLI) commands on your network device (like a router or switch) that is running BGP. The specific commands can vary slightly depending on the vendor (e.g., Cisco, Juniper, Arista), but the core concepts and common commands are similar.
The primary ways to check BGP routes involve looking at the BGP routing table itself, checking specific prefixes, or examining the BGP neighbor status and route exchange summaries.
Viewing the Full BGP Routing Table
The most common way to see all the routes learned via BGP is to display the entire BGP routing table.
- Command:
show ip bgp
(Cisco IOS/XE/XR, Arista EOS) or similar vendor-specific commands.
This command will show you the list of BGP-learned networks, along with information like the next-hop IP address, the origin of the route (e.g., iBGP, eBGP), the AS-Path, and other BGP attributes used for path selection.
Example Output Snippet (Illustrative):
Status codes: s - suppressed, d - damped, h - history, * - valid, > - best, i - internal,
r - RIB-failure, S - Stale, M - multipath, x - cross reality
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.0.0.0/8 192.168.1.1 0 65001 i
*>i172.16.0.0/16 10.1.1.1 0 100 0 i
*> 192.168.2.0/24 192.168.1.5 0 65002 65003 i
*
indicates a valid route.>
indicates the best path selected by BGP.- The
Path
column shows the AS numbers traversed to reach the network.
Checking a Specific BGP Route
If you want to check the details for a particular network prefix, you can specify it with the show ip bgp
command.
- Command:
show ip bgp <prefix>
(e.g.,show ip bgp 192.168.2.0/24
)
This command provides detailed information about the specified route, including all the BGP attributes associated with it (Origin, AS-Path, Next-Hop, Metric, Local Preference, MED, Communities, etc.) and why a particular path was chosen as the best.
Checking BGP Neighbor Status and Summary
While not showing individual routes, checking the BGP neighbor summary is a crucial first step to verify if BGP is operational and exchanging routes.
- Command:
show ip bgp summary
(Cisco IOS/XE/XR, Arista EOS) or similar.
As noted in the reference: This command displays a summary of the BGP neighbors, their state, the number of prefixes received and sent, and other information. You can use this command to quickly check if your BGP neighbors are up or down, and how many routes they are exchanging.
This command is invaluable for quickly troubleshooting BGP peering issues. If a neighbor's state is not Established
, or the number of received prefixes is zero or unexpectedly low, it indicates a problem preventing route exchange.
Example Output Snippet (Illustrative):
Neighbor | V | AS | MsgRcv | MsgSent | TblVer | InQ | OutQ | Up/Down | State/PfxRcd |
---|---|---|---|---|---|---|---|---|---|
192.168.1.1 | 4 | 65001 | 1234 | 1200 | 5678 | 0 | 0 | 1w2d | 500 |
10.1.1.1 | 4 | 65000 | 500 | 510 | 5678 | 0 | 0 | 5d | 1200 |
192.168.1.5 | 4 | 65003 | 10 | 8 | 5678 | 0 | 0 | 00:01:30 | Active |
In this example, 192.168.1.1
and 10.1.1.1
show an established state (Up/Down
time is present and State/PfxRcd
shows a count), indicating they are successfully exchanging routes. 192.168.1.5
is in an Active
state, suggesting it is trying to establish a peering but hasn't succeeded yet, and no prefixes have been received.
By using these commands (show ip bgp
, show ip bgp <prefix>
, and show ip bgp summary
), network administrators can effectively monitor and troubleshoot the BGP routing process and the specific routes learned and advertised.