clear ip ospf process
Force OSPF to restart after priority changes, router-id changes, or to recover from a stuck neighbour state.
Definition: clear ip ospf process is a Cisco IOS privileged exec command. Resets all OSPF processes, tearing down all neighbour adjacencies and flushing the LSDB, forcing OSPF to re-elect the DR/BDR and rebuild the routing table from scratch.
Overview
The 'clear ip ospf process' command is a powerful and disruptive troubleshooting tool used in Cisco IOS to reset the OSPF routing process on a router. When executed, it terminates the OSPF process, clears all OSPF data structures (including neighbor adjacencies, link-state database, and routing table entries learned via OSPF), and then restarts the process from scratch. This forces the router to re-establish neighbor relationships, re-exchange LSAs, and re-compute the SPF tree.
The command is essential when OSPF enters an inconsistent state due to configuration changes, flapping interfaces, or software bugs that cause stale LSAs or incorrect adjacencies. It is often used after modifying OSPF parameters (such as router-id, network type, or area definitions) that require a full reset to take effect. Unlike 'clear ip ospf neighbors', which only resets neighbor relationships, this command performs a complete OSPF restart.
The command is executed in privileged EXEC mode (enable) and does not affect the running configuration; OSPF will restart with the same configured parameters. However, it temporarily disrupts OSPF routing, causing a brief outage until adjacencies are re-established. Network engineers should use it cautiously in production environments, preferably during maintenance windows.
The command is available in all IOS versions (12.x, 15.x, 16.x) and IOS-XE, but not in NX-OS (which uses 'restart ospf' or 'clear ip ospf process' with different syntax). Understanding when to use this command versus more granular OSPF troubleshooting commands is key to efficient network operations.
clear ip ospf [process-id] processWhen to Use This Command
- Apply a new ospf priority value without rebooting — OSPF elections are non-preemptive so you must reset the process
- Force a router-id change to take effect after modifying the loopback or router-id command
- Recover from a neighbour stuck in EXSTART or LOADING state
- Clear a corrupted LSDB after a topology change that OSPF failed to process
Command Examples
Reset OSPF process 1 to trigger new DR election
Router# clear ip ospf 1 process Reset OSPF process? [no]: yes %OSPF-5-ADJCHG: Process 1, Nbr 10.0.0.2 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Adjacency forced to reset
Understanding the Output
IOS prompts for confirmation (type yes). The syslog message shows each adjacency torn down from FULL to DOWN. After reset, watch show ip ospf neighbor for neighbors to cycle through INIT → 2WAY → EXSTART → EXCHANGE → LOADING → FULL.
Configuration Scenarios
Resetting OSPF after changing the router-id
After changing the OSPF router-id (e.g., from a loopback interface to a different IP), OSPF does not automatically use the new router-id until the process is restarted. This scenario demonstrates how to force OSPF to adopt the new router-id.
Topology
R1(Lo0:1.1.1.1)---(Gi0/0:10.0.12.1/24)---(Gi0/0:10.0.12.2/24)R2(Lo0:2.2.2.2)Steps
- 1.Step 1: Verify current OSPF router-id on R1: show ip ospf | include Router ID
- 2.Step 2: Change the router-id by configuring a new loopback interface: interface Loopback1, ip address 3.3.3.3 255.255.255.255
- 3.Step 3: Reconfigure OSPF to use the new router-id: router ospf 1, router-id 3.3.3.3
- 4.Step 4: Reset OSPF process to apply the new router-id: clear ip ospf process
- 5.Step 5: Confirm the new router-id: show ip ospf | include Router ID
! interface Loopback1 ip address 3.3.3.3 255.255.255.255 ! router ospf 1 router-id 3.3.3.3 ! end clear ip ospf process
Verify: show ip ospf | include Router ID Expected output: 'Router ID 3.3.3.3'
Watch out: The router-id must be unique in the OSPF domain; using an IP that is already in use by another router will cause adjacency problems.
Recovering from OSPF neighbor flapping due to mismatched parameters
When OSPF neighbors flap due to mismatched parameters (e.g., hello/dead intervals, network type, or area ID), simply correcting the configuration may not immediately stabilize the adjacency. Resetting the OSPF process can clear stale state and force a fresh adjacency establishment.
Topology
R1(Gi0/0:10.0.12.1/24)---(Gi0/0:10.0.12.2/24)R2Steps
- 1.Step 1: Identify the flapping neighbor on R1: show ip ospf neighbor
- 2.Step 2: Check for mismatched parameters: show ip ospf interface gi0/0
- 3.Step 3: Correct the mismatched parameter on R1 (e.g., change network type to broadcast): interface gi0/0, ip ospf network broadcast
- 4.Step 4: Reset OSPF process on R1: clear ip ospf process
- 5.Step 5: Verify neighbor state stabilizes: show ip ospf neighbor
! interface GigabitEthernet0/0 ip ospf network broadcast ! end clear ip ospf process
Verify: show ip ospf neighbor Expected output: neighbor 10.0.12.2 in FULL state, stable
Watch out: Resetting OSPF process on one router may cause temporary routing blackhole; ensure redundant paths exist or schedule during maintenance.
Troubleshooting with This Command
When troubleshooting OSPF issues, the 'clear ip ospf process' command is a last resort due to its disruptive nature. Before using it, engineers should gather baseline data with 'show ip ospf neighbor', 'show ip ospf database', and 'show ip route ospf'. Healthy output shows neighbors in FULL state, a synchronized database, and OSPF routes in the routing table.
Problem indicators include neighbors stuck in INIT, EXSTART, or EXCHANGE states, missing LSAs, or routing table entries that are stale or missing. Common symptoms that may warrant a reset include: OSPF not using a new router-id after configuration, persistent neighbor flapping despite correct parameters, or a corrupted link-state database. A step-by-step diagnostic flow: 1) Check neighbor states; if multiple neighbors are stuck, suspect a Layer 2 issue or mismatched parameters. 2) Verify OSPF interface parameters (hello/dead timers, network type, area). 3) Examine the OSPF database for missing or duplicate LSAs. 4) If all else fails, use 'clear ip ospf process' to restart OSPF.
After the reset, monitor the re-establishment process with 'debug ip ospf adj' (use cautiously) and verify that neighbors come up and routes are learned. Correlate with 'show ip ospf events' to see the adjacency transitions. Note that the command does not affect the running config, but it will cause a temporary routing outage.
In large networks, consider using 'clear ip ospf neighbor' for targeted resets or 'reload' as a more drastic measure.
CCNA Exam Tips
CCNA exam: ospf priority changes are NOT effective until you clear the process or reboot
The DR is elected based on priority first, then highest router-id
A router that joins after the election always becomes DRother regardless of priority — only clear ip ospf process forces a re-election
Common Mistakes
Changing ospf priority and expecting it to take effect immediately
Forgetting the confirmation prompt (must type yes)
Running this on a production router without warning — all OSPF routes disappear briefly and traffic black-holes until adjacencies reform
clear ip ospf process vs show ip ospf neighbor
These commands are often considered together because both are essential for OSPF troubleshooting, yet they serve opposite purposes: one is a disruptive reset action and the other is a non-disruptive inspection command.
| Aspect | clear ip ospf process | show ip ospf neighbor |
|---|---|---|
| Scope | All OSPF processes on the router | OSPF neighbor table only |
| Configuration mode | Privileged EXEC | Privileged EXEC |
| Persistence | Temporary; effect lasts until OSPF re-converges | No persistent effect; output is transient |
| Precedence | Destructive; clears adjacencies and LSDB | Non-destructive; no operational impact |
| Typical use | Recover from OSPF issues or force re-election | Verify neighbor state and adjacency health |
Use clear ip ospf process when you need to force OSPF to reset all adjacencies and rebuild the database due to configuration changes or persistent neighbor issues.
Use show ip ospf neighbor when you want to monitor OSPF neighbor status, verify adjacencies are forming, or check the DR/BDR election without disrupting the network.
Platform Notes
In IOS-XE (e.g., Catalyst 9000 switches), the 'clear ip ospf process' command behaves identically to classic IOS. However, on some IOS-XE platforms, the command may prompt for confirmation: 'Reset OSPF process? [no]'. This is a safety feature to prevent accidental disruption.
In NX-OS (Cisco Nexus switches), the equivalent command is 'clear ip ospf process' but with different syntax: 'clear ip ospf process <process-id>' or 'restart ospf <process-id>'. NX-OS also supports 'clear ip ospf neighbors' for less disruptive resets. On Cisco ASA firewalls, OSPF is supported in routed mode, and the command is 'clear ospf process' (without 'ip').
In IOS-XR, the command is 'clear ospf process' (also without 'ip'), and it requires the 'c' (configuration) mode or 'admin' privileges. IOS-XR also has 'clear ospf redistribution' for clearing only redistributed routes. Version differences: In IOS 12.x, the command did not prompt for confirmation; in 15.x and later, a confirmation prompt was added.
Always check the specific platform documentation, as some older IOS versions may require the 'force' keyword to skip the prompt (e.g., 'clear ip ospf process force').
Related Commands
auto-cost reference-bandwidth
Changes the OSPF reference bandwidth used to calculate interface costs. Default is 100 Mbps, which assigns cost 1 to any interface 100 Mbps or faster — causing FastEthernet and GigabitEthernet to have the same cost.
show ip ospf neighbor
Displays OSPF neighbour table showing router IDs, adjacency state, dead timer, and the interface the neighbour is reachable through.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions