Courseiva
BGPPrivileged EXEC

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.

Syntax·Privileged EXEC
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/24
BGP 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, external

Two 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

1.

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.

2.

CCNA exam tip: 'show ip bgp' without an argument shows the entire BGP table — useful for seeing all prefixes.

3.

CCNA exam tip: A route marked 'valid' but not 'best' is in the table but not used — another path won the selection.

4.

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.

Aspectshow ip bgp [prefix]show ip bgp
Output CoverageSingle prefix onlyEntire BGP table (all prefixes)
Level of DetailAll paths for prefix, including multipath, backup, and path selection detailsOne line per route/path, with key attributes but no per-path election breakdown
Filter CapabilityExact prefix match; no partial or subnet matchingNo filtering; always shows entire table
Performance ImpactLow – retrieves a single prefix entryHigh – may take time on large tables; can cause CPU spikes
Typical Troubleshooting ScenarioInvestigating why a specific prefix is not being advertised or selected as bestChecking 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

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions