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.
Definition: show ip bgp is a Cisco IOS privileged exec command. Displays the BGP routing table, showing learned BGP routes and their attributes, used for troubleshooting BGP path selection and verifying route advertisement.
Overview
The `show ip bgp` command is a fundamental diagnostic tool for any network engineer working with BGP (Border Gateway Protocol). It displays the BGP routing table, which contains all routes learned via BGP from neighbors, along with their associated attributes such as AS path, next hop, local preference, and MED. This command is essential for verifying route advertisement, troubleshooting path selection issues, and understanding the BGP decision process.
Unlike `show ip route`, which shows the best route installed in the routing table, `show ip bgp` reveals all BGP routes (including backup paths) and their status (e.g., valid, best, suppressed). It is typically used when a network is not converging as expected, when routes are missing, or when suboptimal path selection occurs. The command fits into the broader troubleshooting workflow after verifying BGP neighbor states with `show ip bgp summary` and before checking the routing table with `show ip route`.
In IOS, the output can be lengthy, so it is often piped to `more` or filtered with `include` or `begin`. The command requires privileged EXEC mode (enable) and does not modify the running configuration. Important IOS behavior: the output is buffered and may be truncated in terminal sessions with limited scrollback; using `terminal length 0` disables paging.
The command also supports various parameters to filter by prefix, neighbor, or attribute, making it highly versatile for targeted troubleshooting.
show ip bgpWhen to Use This Command
- Verify that BGP routes are being received from a neighbor after establishing a BGP session.
- Check the best path selection by examining path attributes like local preference, AS path, and MED.
- Troubleshoot missing routes or suboptimal routing by comparing BGP table entries across routers.
- Confirm that route filtering or policy changes are applied correctly by inspecting the BGP table.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| network | A.B.C.D | Displays BGP routes for a specific network prefix. The prefix must be in dotted decimal format (e.g., 10.0.0.0). Common mistake: omitting the mask; the command will show routes for the exact prefix if no mask is given, but if a mask is needed, use the full prefix/mask syntax. |
| mask | A.B.C.D | Specifies the subnet mask for the network prefix (e.g., 255.255.255.0). Must be used with the network parameter. Common mistake: using CIDR notation instead of dotted decimal mask; the command expects the mask in dotted decimal format. |
| neighbors | A.B.C.D | Displays BGP routes received from or advertised to a specific neighbor. The neighbor IP address must be a valid BGP peer. Common mistake: using the neighbor's router ID instead of the IP address used for the BGP session. |
| received-routes | received-routes | Shows all routes received from a specified neighbor (before inbound policy). Must be used with the neighbors parameter. Common mistake: forgetting that this command may not show all routes if soft-reconfiguration is not enabled. |
| routes | routes | Displays all BGP routes in the table. This is the default behavior when no parameters are given. Common mistake: assuming this shows only best routes; it shows all routes, including non-best. |
| summary | summary | Provides a summary of BGP neighbor states and route counts. Useful for a quick overview. Common mistake: using this to see detailed route attributes; it only shows counts and neighbor status. |
| community | community <community-value> | Filters routes by BGP community attribute. The community value can be in AA:NN format (e.g., 100:200) or well-known (e.g., no-export). Common mistake: forgetting to include the colon separator or using invalid community values. |
| filter-list | filter-list <access-list-number> | Filters routes based on an AS-path access list. The access list number must be defined globally. Common mistake: using an IP access list instead of an AS-path access list. |
| prefix-list | prefix-list <prefix-list-name> | Filters routes based on a prefix list. The prefix list must be configured globally. Common mistake: using a route-map name instead of a prefix-list name. |
| route-map | route-map <route-map-name> | Filters routes based on a route-map. The route-map must be configured globally. Common mistake: applying a route-map that modifies attributes; the command only filters, it does not apply the route-map actions. |
| inconsistent-as | inconsistent-as | Displays routes with inconsistent AS path information, often indicating a misconfiguration. Common mistake: assuming this shows all routes with AS path issues; it only shows routes where the AS path does not match the expected origin. |
| regexp | regexp <regular-expression> | Filters routes by AS path using a regular expression. The expression must follow IOS regex syntax. Common mistake: using PCRE syntax; IOS uses a different regex engine. |
Command Examples
Basic BGP Table Display
show ip bgpBGP table version is 5, local router ID is 192.168.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.1.0/24 192.168.2.2 0 0 65001 i
*> 10.2.2.0/24 192.168.3.3 0 0 65002 65003 i
*> 172.16.0.0/16 192.168.4.4 0 0 65004 iThe output shows the BGP table. 'Status codes' indicate route validity: * means valid, > means best. 'Network' is the prefix learned. 'Next Hop' is the next-hop IP. 'Metric' is the MED value. 'LocPrf' is local preference (blank if default 100). 'Weight' is Cisco-specific weight. 'Path' shows the AS_PATH. 'Origin' code i means IGP (network command), e means EGP, ? means redistributed. The first route is best and valid, learned from AS 65001 with origin IGP. The second route passes through AS 65002 and 65003.
BGP Table with Prefixes Not Installed in Routing Table
show ip bgpBGP table version is 10, local router ID is 10.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.1.0/24 10.0.0.2 0 0 100 i
r 10.2.2.0/24 10.0.0.3 0 0 200 i
*> 10.3.3.0/24 10.0.0.4 0 0 300 iThe 'r' status code indicates RIB-failure: the route is valid but not installed in the routing table (e.g., due to administrative distance conflict or route table full). The other two routes are best and valid. This helps identify routes that are learned but not used.
Understanding the Output
The 'show ip bgp' command displays the BGP routing table. The first line shows the BGP table version (increments with changes) and the local router ID. Status codes indicate the state of each route: '*' means valid, '>' means best (selected for use), 'i' means internal (iBGP), 'r' means RIB-failure (valid but not installed in routing table), 's' suppressed, 'd' damped, etc. The 'Network' column shows the prefix.
'Next Hop' is the IP address of the next-hop router. 'Metric' is the Multi-Exit Discriminator (MED) value. 'LocPrf' is the local preference (default 100, higher is preferred).
'Weight' is a Cisco-specific attribute (higher is preferred). 'Path' shows the AS_PATH (sequence of AS numbers the route traversed). 'Origin' code indicates how the route was originated: i (IGP) from network command, e (EGP) from EGP, ? (incomplete) from redistribution.
A blank LocPrf means default 100. A blank Weight means 0. Good values: best routes selected, no RIB-failures, expected AS paths.
Bad values: missing routes, RIB-failures, unexpected AS paths, high MED (less preferred). Watch for routes with 'r' status or missing best path.
Configuration Scenarios
Verify BGP Route Advertisement Between Two Autonomous Systems
A network engineer needs to confirm that a specific prefix (192.168.1.0/24) is being advertised from AS 65001 to AS 65002 via eBGP. The BGP session is established, but the route is not appearing in the routing table of the neighbor router.
Topology
R1(AS 65001)---(Gi0/0)10.0.12.0/30---(Gi0/0)R2(AS 65002)Steps
- 1.Step 1: On R1, enter privileged EXEC mode: enable
- 2.Step 2: Display the BGP table to see if the prefix is present: show ip bgp
- 3.Step 3: Filter for the specific prefix: show ip bgp 192.168.1.0 255.255.255.0
- 4.Step 4: Check if the route is advertised to neighbor R2: show ip bgp neighbors 10.0.12.2 advertised-routes
- 5.Step 5: On R2, check received routes: show ip bgp neighbors 10.0.12.1 received-routes
! R1 configuration router bgp 65001 neighbor 10.0.12.2 remote-as 65002 network 192.168.1.0 mask 255.255.255.0 ! R2 configuration router bgp 65002 neighbor 10.0.12.1 remote-as 65001
Verify: On R1: `show ip bgp 192.168.1.0` should show the route with status code 'r' (valid) and '>' (best). On R2: `show ip bgp 192.168.1.0` should show the route with an AS path of '65001'.
Watch out: Ensure the network command on R1 includes the correct mask. A common mistake is using a classful mask (e.g., 255.255.255.0 for a /24) but forgetting to specify the mask keyword, which causes the route not to be advertised.
Troubleshoot BGP Path Selection with Multiple Paths
A router in AS 65001 receives two paths for prefix 10.0.0.0/8 from two different eBGP neighbors (AS 65002 and AS 65003). The network engineer wants to verify which path is selected as best and understand why.
Topology
R1(AS 65001)---(Gi0/0)10.0.12.0/30---(Gi0/0)R2(AS 65002)
R1(AS 65001)---(Gi0/1)10.0.13.0/30---(Gi0/0)R3(AS 65003)Steps
- 1.Step 1: On R1, display the BGP table for the prefix: show ip bgp 10.0.0.0 255.0.0.0
- 2.Step 2: Identify the best path (marked with '>') and note its attributes (next hop, local pref, weight, AS path)
- 3.Step 3: Compare attributes between the two paths to understand why one is preferred
- 4.Step 4: If needed, check BGP decision process details: show ip bgp 10.0.0.0 255.0.0.0 longer-prefixes
! R1 configuration router bgp 65001 neighbor 10.0.12.2 remote-as 65002 neighbor 10.0.13.2 remote-as 65003 ! R2 and R3 advertise 10.0.0.0/8
Verify: The output of `show ip bgp 10.0.0.0` should show two entries, one with '>' indicating the best path. The best path will have higher weight, higher local preference, shorter AS path, lower origin code, lower MED, or prefer eBGP over iBGP.
Watch out: A common mistake is forgetting that the BGP best path selection algorithm considers many attributes in order. For example, if both paths have the same local preference and AS path length, the MED is compared only if the paths are from the same AS. Always check the full attribute list.
Troubleshooting with This Command
When troubleshooting BGP issues, `show ip bgp` is your primary tool for examining the BGP table. A healthy output shows routes with status codes 'r' (valid) and '>' (best). The 'r' indicates the route is valid (next hop reachable), and '>' marks the best path selected by the BGP decision process.
Problem indicators include: routes missing entirely (no entry), routes with status 'd' (damped) indicating flap damping, routes with 's' (suppressed) due to aggregation or policy, or routes with 'h' (history) for a flapping route. Focus on the following fields: Network (prefix), Next Hop (must be reachable), Metric (MED), LocPrf (local preference), Weight (Cisco proprietary), Path (AS path), and the status codes. Common symptoms this command helps diagnose include: missing routes (check neighbor advertisement and inbound policy), suboptimal path selection (compare attributes), routing loops (AS path contains local AS), and route flapping (check dampening).
A step-by-step diagnostic flow: 1) Verify BGP neighbor state with `show ip bgp summary`. 2) Check if the prefix is in the BGP table with `show ip bgp <prefix>`. 3) If missing, check inbound updates from neighbor with `show ip bgp neighbors <neighbor> received-routes` (requires soft-reconfiguration). 4) If present but not best, compare attributes with other paths. 5) Check if the route is installed in the routing table with `show ip route <prefix>`. 6) If not installed, verify next-hop reachability and administrative distance. Correlate with `show ip bgp neighbors <neighbor> routes` to see what the neighbor is sending, and `debug ip bgp updates` for real-time updates (use with caution). For path selection issues, `show ip bgp <prefix> bestpath` provides detailed decision process.
Remember that `show ip bgp` shows all BGP routes, not just the best; use `show ip route bgp` to see only installed routes.
CCNA Exam Tips
CCNA exam tip: Remember that '>' indicates the best path selected by BGP; only best paths are installed in the routing table.
CCNA exam tip: The 'r' status (RIB-failure) is a common exam topic—know that it means the route is valid but not installed due to a higher administrative distance from another routing protocol.
CCNA exam tip: Understand that the AS_PATH length is a key BGP attribute; shorter paths are preferred. The exam may ask you to determine the best path based on AS_PATH length.
CCNA exam tip: Be able to identify the origin code: 'i' from network command, '?' from redistribution. The exam might test which origin is preferred (i over e over ?).
Common Mistakes
Mistake 1: Confusing the '>' (best) indicator with the '*' (valid) indicator; only routes with '>' are actually used.
Mistake 2: Assuming a route with 'r' status is not valid; it is valid but not installed in the routing table due to RIB-failure.
Mistake 3: Misinterpreting the AS_PATH column: forgetting that the local AS is not shown in the path (the path lists AS numbers the route has traversed).
show ip bgp vs show ip bgp summary
Both 'show ip bgp' and 'show ip bgp summary' are commonly used to examine BGP status, but they serve different purposes. 'show ip bgp' provides detailed per-route information, while 'show ip bgp summary' offers a high-level overview of BGP peers and table health, leading to confusion when choosing the correct command for a specific task.
| Aspect | show ip bgp | show ip bgp summary |
|---|---|---|
| Scope | Displays all BGP routes in the table with attributes (e.g., AS path, next hop, local preference). | Displays BGP peer status, neighbors, and prefix counts per neighbor. |
| Output Detail | High detail; each route listed separately with full attributes. | Low detail; single-line per neighbor showing state, prefixes received, and up/down time. |
| Typical Use | Troubleshooting path selection, route advertisement, and filtering. | Quickly verifying BGP peering status and overall table size. |
| Speed/Performance | Slower; can be resource-intensive on large tables. | Fast; lightweight even with many neighbors. |
| Information Provided | Prefix, next hop, metric, local pref, origin, and path attributes. | Peering state, time since last reset, prefix counts, and router ID. |
Use show ip bgp when you need to inspect specific BGP routes or troubleshoot path selection and filtering issues.
Use show ip bgp summary when you need a quick health check of BGP neighbors and overall routing table convergence.
Platform Notes
In IOS-XE (e.g., Catalyst 9000 switches), the `show ip bgp` command syntax and output are largely identical to classic IOS, but some newer features like BGP EVPN may have additional parameters. The output format may be slightly different in terms of column alignment, but the key fields remain the same. In NX-OS (Nexus switches), the equivalent command is `show bgp` (without 'ip').
The syntax is similar but uses different parameters; for example, `show bgp ipv4 unicast` to display IPv4 BGP routes. NX-OS also supports `show bgp sessions` for neighbor status. For ASA firewalls, BGP is not supported in classic ASA code; instead, ASAs use routing protocols like OSPF or EIGRP.
However, ASA with FirePOWER services may have BGP capabilities via the FirePOWER module, but the command is not native. In IOS-XR (e.g., ASR 9000), the command is `show bgp` and the output is more structured, often in XML-like format. IOS-XR also uses a different configuration hierarchy.
Between IOS versions, the command has remained consistent from 12.x to 16.x, but newer versions may add additional fields like 'mpls labels' or 'large communities'. Always check the specific IOS documentation for your version. For example, in IOS 15.x, the `show ip bgp` output includes the 'Network' column with prefix length, while in 12.x it may show the mask separately.
The `neighbors` parameter works the same across versions, but `received-routes` requires `soft-reconfiguration inbound` to be configured.
Related Commands
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.
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.
show ip route
Displays the IP routing table showing all known routes, their source protocols, administrative distances, metrics, next-hops, and outgoing interfaces.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions