Courseiva
BGPPrivileged EXEC

clear ip bgp *

Resets all BGP sessions and clears the BGP routing table, forcing a complete re-advertisement and re-learning of all BGP routes from all neighbors.

Definition: clear ip bgp * is a Cisco IOS privileged exec command. Resets all BGP sessions and clears the BGP routing table, forcing a complete re-advertisement and re-learning of all BGP routes from all neighbors.

Overview

The 'clear ip bgp *' command is a powerful and disruptive BGP troubleshooting tool used in Cisco IOS privileged EXEC mode. It resets all BGP sessions and clears the entire BGP routing table, forcing the router to re-establish peering relationships and re-learn all BGP routes from every neighbor. This command is typically employed when there is a need to recover from a BGP table corruption, apply new inbound or outbound route policies, or resolve persistent BGP session issues that are not fixed by less aggressive measures.

The underlying concept is that BGP is a path-vector protocol that maintains a separate routing table (the BGP table) and relies on TCP sessions between peers. When the BGP table is cleared, all learned routes are removed, and the router sends new OPEN messages to each neighbor, triggering a complete re-advertisement of routes. This can cause significant network disruption, as all BGP routes are withdrawn and then re-advertised, potentially leading to temporary blackholing of traffic.

Therefore, it should only be used during maintenance windows or in emergency situations where other troubleshooting steps have failed. Alternatives include 'clear ip bgp <neighbor-ip>' to reset a single session, 'clear ip bgp * soft' to perform a soft reset without tearing down the session (if route refresh capability is supported), or 'clear ip bgp * soft out' to resend routes without re-learning. The 'clear ip bgp *' command is often part of a broader workflow: first, verify the BGP table with 'show ip bgp', check neighbor states with 'show ip bgp summary', and then, if a global reset is deemed necessary, execute the clear command.

After the clear, monitor the BGP convergence using 'show ip bgp summary' and 'show ip route bgp'. Important IOS behaviors: the command is executed in privileged EXEC mode (enable mode), not in configuration mode. It does not affect the running configuration; it only resets dynamic state.

The output is immediate and does not produce a confirmation prompt, so caution is required. The command can be CPU-intensive, especially with many peers and routes, and may cause a spike in CPU utilization. It is also important to note that the 'clear ip bgp *' command does not clear the BGP table if the router is configured with BGP graceful restart; in that case, the session reset may be deferred.

Additionally, the command may be buffered if issued during high CPU load, but typically it executes immediately. Privilege level 15 is required by default, though it can be customized. This command is a staple for CCNP and CCNA candidates to understand, as it represents the most aggressive BGP reset and is often tested in troubleshooting scenarios.

Syntax·Privileged EXEC
clear ip bgp *

When to Use This Command

  • After making major BGP policy changes (e.g., route maps, prefix lists) that require all sessions to reset to take effect.
  • When troubleshooting BGP convergence issues and need to force a full route refresh from all peers.
  • After upgrading or rebooting a BGP router to re-establish all BGP sessions and rebuild the routing table.
  • When testing BGP failover scenarios by simulating a complete BGP reset.

Parameters

ParameterSyntaxDescription
**The asterisk is a wildcard that indicates all BGP sessions should be reset. There are no other parameters for this command. It is the only option and must be entered exactly as shown. A common mistake is to forget the asterisk or to use a specific IP address instead, which would reset only that neighbor.

Command Examples

Basic BGP session reset

clear ip bgp *

No output is displayed. The command immediately resets all BGP sessions. Use 'show ip bgp summary' to verify sessions re-establish.

Verifying after reset

show ip bgp summary
BGP router identifier 192.168.1.1, local AS number 65001
BGP table version is 1, main routing table version 1
Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.0.2        4        65002       0       0        0    0    0 never    Active
10.0.0.3        4        65003       0       0        0    0    0 never    Active

After 'clear ip bgp *', all neighbors show 'Active' state and zero messages. The 'Up/Down' column shows 'never' indicating sessions are being re-established. Wait for them to reach 'Established' state.

Understanding the Output

The 'clear ip bgp *' command produces no direct output. To verify its effect, use 'show ip bgp summary'. Key fields: 'Neighbor' – peer IP; 'V' – BGP version; 'AS' – neighbor's AS number; 'MsgRcvd/MsgSent' – messages exchanged; 'TblVer' – table version; 'InQ/OutQ' – queued messages; 'Up/Down' – time since last state change; 'State/PfxRcd' – current session state or number of prefixes received.

After a clear, all neighbors should show 'Active' or 'Connect' and eventually 'Established'. If any neighbor remains in 'Idle' or 'Active', there may be a connectivity or configuration issue.

Configuration Scenarios

Global BGP Reset After Policy Change

An enterprise network has multiple BGP peers (two ISPs and an internal iBGP mesh). After modifying inbound route-maps to filter certain prefixes, the network engineer needs to apply the new policy to all neighbors simultaneously without waiting for individual session resets.

Topology

R1(Gi0/0)---10.0.12.0/30---(Gi0/0)ISP1 R1(Gi0/1)---10.0.13.0/30---(Gi0/0)ISP2 R1(Lo0)---192.168.1.1/32 R2(Gi0/0)---10.0.24.0/30---(Gi0/0)R1 R3(Gi0/0)---10.0.34.0/30---(Gi0/0)R1

Steps

  1. 1.Step 1: Enter privileged EXEC mode: Router> enable
  2. 2.Step 2: Verify current BGP table and neighbors: show ip bgp summary
  3. 3.Step 3: Apply the new inbound route-map to the BGP process: Router(config)# router bgp 65001, Router(config-router)# neighbor 10.0.12.2 route-map FILTER-ISP1 in, Router(config-router)# neighbor 10.0.13.2 route-map FILTER-ISP2 in
  4. 4.Step 4: Exit configuration mode: Router(config-router)# end
  5. 5.Step 5: Reset all BGP sessions to apply the new policy: Router# clear ip bgp *
  6. 6.Step 6: Monitor BGP convergence: Router# show ip bgp summary (wait for all neighbors to reach Established state)
  7. 7.Step 7: Verify that only desired prefixes are in the BGP table: Router# show ip bgp
Configuration
! BGP configuration on R1
router bgp 65001
 bgp log-neighbor-changes
 neighbor 10.0.12.2 remote-as 65002
 neighbor 10.0.12.2 route-map FILTER-ISP1 in
 neighbor 10.0.13.2 remote-as 65003
 neighbor 10.0.13.2 route-map FILTER-ISP2 in
 neighbor 10.0.24.2 remote-as 65001
 neighbor 10.0.34.2 remote-as 65001
!

Verify: Use 'show ip bgp summary' to confirm all neighbors are in Established state. Use 'show ip bgp' to verify that only permitted prefixes are present. Expected output: BGP table shows only routes that match the inbound route-maps.

Watch out: A common mistake is forgetting that 'clear ip bgp *' also resets iBGP sessions, which can cause temporary routing loops if the iBGP full mesh is not stable. Always ensure that the IGP (e.g., OSPF) is converged before resetting BGP.

Recovering from BGP Table Corruption

A router experiences BGP table corruption due to a memory error, resulting in inconsistent routing and flapping BGP sessions. The network engineer decides to perform a hard reset of all BGP sessions to force a clean re-learning of routes.

Topology

R1(Gi0/0)---10.0.12.0/30---(Gi0/0)R2 (eBGP) R1(Gi0/1)---10.0.13.0/30---(Gi0/0)R3 (eBGP) R1(Lo0)---192.168.1.1/32

Steps

  1. 1.Step 1: Enter privileged EXEC mode: Router> enable
  2. 2.Step 2: Check BGP neighbor states: show ip bgp summary (look for flapping or Idle states)
  3. 3.Step 3: Check BGP table for inconsistencies: show ip bgp (look for missing routes or duplicate entries)
  4. 4.Step 4: Save the current configuration: Router# copy running-config startup-config
  5. 5.Step 5: Reset all BGP sessions: Router# clear ip bgp *
  6. 6.Step 6: Monitor the re-establishment of BGP sessions: Router# show ip bgp summary (wait for all neighbors to reach Established)
  7. 7.Step 7: Verify BGP table integrity: Router# show ip bgp (check that all expected routes are present and no anomalies)
  8. 8.Step 8: Check routing table: Router# show ip route bgp
Configuration
! No configuration change is needed; the existing BGP config remains.
router bgp 65001
 bgp log-neighbor-changes
 neighbor 10.0.12.2 remote-as 65002
 neighbor 10.0.13.2 remote-as 65003
!

Verify: Use 'show ip bgp summary' to confirm all neighbors are Established. Use 'show ip bgp' to verify that the BGP table is consistent and contains all expected prefixes. Expected output: BGP table shows correct routes without duplicates or missing entries.

Watch out: A common mistake is not saving the configuration before the clear. If the corruption is due to a configuration error, the clear may not fix the issue. Also, if the router has many peers, the clear can cause a significant CPU spike; consider performing it during a maintenance window.

Troubleshooting with This Command

When using 'clear ip bgp *' for troubleshooting, it is essential to understand what healthy output looks like versus problem indicators. Healthy output after the clear is indicated by all BGP neighbors quickly transitioning to the Established state, as shown in 'show ip bgp summary'. The BGP table should populate with the expected number of prefixes, and the routing table should reflect the best paths.

Problem indicators include neighbors stuck in Idle, Active, or Connect states, which may suggest TCP connectivity issues, incorrect BGP configuration, or authentication failures. Another indicator is a slow or incomplete BGP table convergence, which could point to route flapping or excessive prefix filtering. The command helps diagnose issues such as BGP session flapping, where sessions repeatedly go up and down; a hard reset can temporarily stabilize the session, but the underlying cause (e.g., mismatched hold timers, MTU issues) must be addressed.

It also helps when inbound or outbound route policies are not being applied correctly; after the clear, if the policy is misconfigured, the expected routes may not appear. A step-by-step diagnostic flow: 1) Before the clear, collect baseline data: 'show ip bgp summary', 'show ip bgp', 'show ip route bgp', and 'show logging'. 2) Execute 'clear ip bgp *'. 3) Immediately after, monitor the BGP neighbor states using 'show ip bgp summary' every few seconds. 4) Once neighbors are Established, compare the BGP table with the baseline to identify missing or extra routes. 5) If problems persist, check for ACLs blocking TCP port 179, verify BGP timers, and examine the BGP configuration for errors. Correlate the output with 'debug ip bgp updates' (use with caution) to see the actual route advertisements.

Also, use 'show tcp brief' to verify TCP sessions to BGP peers. The command is a blunt instrument; it should be used only when less disruptive methods like soft reset ('clear ip bgp * soft') are not effective or when a complete re-learning is required. In production networks, it is advisable to schedule the clear during low-traffic periods and to have a rollback plan.

Understanding the output of 'show ip bgp' after the clear is critical: look for the 'Network' column to see prefixes, 'Next Hop' for the next-hop address, 'Path' for AS path, and 'Weight/Local Pref' for path selection. Any anomalies in these fields can indicate policy misconfigurations. Finally, always check the router's CPU and memory after the clear, as the process can be resource-intensive.

CCNA Exam Tips

1.

CCNA exam tip: 'clear ip bgp *' is disruptive; it resets all BGP sessions. Use 'clear ip bgp <neighbor>' to reset a single session.

2.

CCNA exam tip: After clearing BGP, the router sends OPEN messages to re-establish sessions. The 'Up/Down' time resets to 'never' until the session comes up.

3.

CCNA exam tip: BGP route flapping can be caused by frequent clears. Use 'bgp dampening' to mitigate instability.

4.

CCNA exam tip: The command does not affect the BGP configuration; only runtime sessions and the routing table are cleared.

Common Mistakes

Mistake 1: Using 'clear ip bgp *' for minor policy changes; it causes unnecessary network disruption. Use 'clear ip bgp * soft' for a soft reset instead.

Mistake 2: Forgetting to verify BGP sessions after the clear; sessions may fail to re-establish due to misconfiguration.

Mistake 3: Assuming the command clears only the BGP table; it also resets all TCP sessions with BGP peers.

clear ip bgp * vs show ip bgp summary

The commands 'clear ip bgp *' and 'show ip bgp summary' are often paired in BGP troubleshooting workflows: one provides a snapshot of neighbor status and prefix counts, while the other forcefully resets all BGP sessions and clears the routing table. They represent the extremes of disruptive versus non-disruptive actions in BGP management.

Aspectclear ip bgp *show ip bgp summary
ScopeAll BGP neighbors globallySummary of all neighbors
ModePrivileged EXEC (disruptive)Privileged EXEC (non-disruptive)
Effect on BGP TableClears entire BGP tableNone (read-only)
Impact on NeighborsResets all BGP sessions, clearing all routesNone
Typical UseRecover from table corruption or apply new policyVerify peering status and prefix counts

Use clear ip bgp * when you need a full reset of BGP sessions to recover from a soft error or to force immediate application of a new outbound policy.

Use show ip bgp summary when you need a quick, non-disruptive check of BGP neighbor states, uptime, and prefix counts for monitoring or initial troubleshooting.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 switches, ASR 1000), the 'clear ip bgp *' command behaves identically to classic IOS. However, IOS-XE may have additional options like 'clear ip bgp * vrf <vrf-name>' to reset BGP sessions within a specific VRF. The syntax and output format are largely the same, but IOS-XE may display additional fields in 'show ip bgp summary' such as 'Up/Down' state timestamps.

In NX-OS (Cisco Nexus switches), the equivalent command is 'clear bgp *' (without 'ip'), executed in privileged EXEC mode. For example, 'clear bgp *' resets all BGP sessions. NX-OS also supports 'clear bgp ipv4 unicast *' to clear only IPv4 unicast sessions.

Additionally, NX-OS uses a different BGP configuration hierarchy (under 'router bgp' then 'address-family'). For ASA firewalls, BGP is not supported in classic ASA code; however, in ASA with FirePOWER services or in routed mode with BGP (rare), the command is not available. In IOS-XR (Cisco ASR 9000, CRS), the command is 'clear bgp *' (similar to NX-OS) but with a different syntax: 'clear bgp *' resets all BGP sessions, but IOS-XR requires specifying the address family, e.g., 'clear bgp ipv4 unicast *'.

IOS-XR also has a 'clear bgp * soft' for soft reset. Between IOS versions, there are minimal differences: in IOS 12.x, the command is the same, but the output of 'show ip bgp' may have slightly different formatting. In IOS 15.x and 16.x, the command remains unchanged.

One important note: in some IOS versions, the 'clear ip bgp *' command may not clear the BGP table if BGP graceful restart is enabled and the peer supports it; the session may be preserved. To force a hard reset, you may need to use 'clear ip bgp * hard' or disable graceful restart. Always check the specific IOS documentation for your version.

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