show ip bgp [prefix]
Shows all BGP paths and attributes for a specific prefix to diagnose routing decisions.
Definition: show ip bgp [prefix] is a Cisco IOS privileged exec command. Displays detailed BGP path information for a specific prefix, including all paths received from all peers, BGP attributes (AS path, local preference, MED, weight), and which path is selected as best.
show ip bgp <network-address>[/<prefix-length>]When to Use This Command
- Troubleshooting why a specific prefix is using one path over another.
- Verifying BGP attributes (AS path, local pref, weight, MED) affecting path selection.
- Confirming a prefix is in the BGP table and installed in the routing table.
- Checking which peer originated a specific route.
Command Examples
Show all paths for a specific prefix
R1# show ip bgp 198.51.100.0/24BGP routing table entry for 198.51.100.0/24, version 5
Paths: (2 available, best #1, table default)
Advertised to update-groups:
1
100 200
203.0.113.1 from 203.0.113.1 (203.0.113.1)
Origin IGP, metric 0, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0
100 300 200
203.0.113.5 from 203.0.113.5 (203.0.113.5)
Origin IGP, metric 0, localpref 100, valid, externalTwo paths exist. Path 1 via 203.0.113.1 has AS path '100 200' (shorter) and is marked 'best'. Path 2 via 203.0.113.5 has AS path '100 300 200' (longer). BGP prefers the shorter AS path, making path 1 best.
Prefix not in BGP table
R1# show ip bgp 10.0.0.0% Network not in table
The prefix 10.0.0.0 is not in the BGP table — either no peer has advertised it, or it was filtered.
Understanding the Output
Key fields: '>' = best path, 'i' = iBGP source, 'e' = eBGP source. AS path is listed after the peer IP (shorter = preferred). 'localpref' (default 100) — higher wins.
'weight' (Cisco-proprietary) — higher wins, only affects local router. 'metric' = MED — lower wins. 'valid' = next hop is reachable.
'best' = selected path. The best path is installed in the IP routing table.
CCNA Exam Tips
CCNA exam tip: BGP path selection order (simplified): weight > local-pref > locally originated > AS path length > origin code > MED > eBGP over iBGP > IGP metric to next hop.
CCNA exam tip: 'show ip bgp' without an argument shows the entire BGP table — useful for seeing all prefixes.
CCNA exam tip: A route marked 'valid' but not 'best' is in the table but not used — another path won the selection.
CCNA exam tip: A route with no '>' is not installed in the routing table.
Common Mistakes
Mistake 1: Confusing 'show ip bgp' with 'show ip route' — BGP table and routing table are separate. A prefix can be in BGP but not installed if a better-admin-distance route exists.
Mistake 2: Forgetting that BGP only installs the BEST path into the routing table by default.
Mistake 3: Misreading AS path — path '100 200' means the traffic traverses AS 100 then AS 200; the origin AS is last (rightmost).
show ip bgp [prefix] vs show ip bgp
Both 'show ip bgp' and 'show ip bgp [prefix]' are used to inspect the BGP table, but they serve different purposes. The former displays the entire BGP routing table, summarizing each route with its attributes, while the latter drills down into all paths for a specific prefix, showing detailed path selection information. They are commonly confused because the prefix variant is often mistakenly thought to simply filter the output of the base command.
| Aspect | show ip bgp [prefix] | show ip bgp |
|---|---|---|
| Output Coverage | Single prefix only | Entire BGP table (all prefixes) |
| Level of Detail | All paths for prefix, including multipath, backup, and path selection details | One line per route/path, with key attributes but no per-path election breakdown |
| Filter Capability | Exact prefix match; no partial or subnet matching | No filtering; always shows entire table |
| Performance Impact | Low – retrieves a single prefix entry | High – may take time on large tables; can cause CPU spikes |
| Typical Troubleshooting Scenario | Investigating why a specific prefix is not being advertised or selected as best | Checking overall BGP convergence, seeing all learned routes, or verifying route advertisement |
Use 'show ip bgp [prefix]' when you need to see all BGP paths for a specific route and understand why the router selected (or did not select) the best path.
Use 'show ip bgp' when you want a quick overview of all BGP routes in the table, such as checking if a route is learned or verifying the number of prefixes.
Related Commands
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 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.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions