Courseiva
SystemPrivileged EXEC

erase startup-config

Deletes the startup configuration file from NVRAM, causing the router to load with factory defaults on next reload.

Definition: erase startup-config is a Cisco IOS privileged exec command. Deletes the startup configuration file from NVRAM, causing the router to load with factory defaults on next reload.

Overview

The `erase startup-config` command is a critical IOS command used to delete the startup configuration file stored in NVRAM (Non-Volatile Random Access Memory). When executed, it removes the configuration that the router loads upon boot, effectively resetting the device to factory defaults after the next reload. This command is essential for network engineers when decommissioning equipment, preparing routers for redeployment, or recovering from severe misconfigurations that prevent normal operation.

The underlying concept is the separation of running-config (active in RAM) and startup-config (persistent in NVRAM). By erasing the startup-config, the engineer ensures that the next reboot will not apply any previously saved configuration, allowing the router to boot with default settings. This is often the first step in a configuration recovery process, such as password recovery or after a corrupt configuration.

Alternatives include using `write erase` (which is synonymous) or manually deleting specific files via `delete nvram:startup-config`. The command is typically used in conjunction with `reload` to force the router to boot with no configuration. Important IOS behaviors: the command does not affect the running configuration; the router continues to operate with the current config until reloaded.

The output is immediate with no confirmation prompt by default (though some IOS versions may prompt). Privilege level 15 (Privileged EXEC mode) is required. The command is available in all IOS versions and is a staple for network engineers.

It fits into workflows such as device reset, lab setup, or disaster recovery. Understanding this command is fundamental for CCNA and CCNP candidates as it demonstrates knowledge of device initialization and configuration management.

Syntax·Privileged EXEC
erase startup-config

When to Use This Command

  • Resetting a router to factory defaults before redeploying in a different network
  • Clearing a misconfigured startup config that prevents the router from booting correctly
  • Preparing a router for secure disposal or return to vendor
  • Troubleshooting by eliminating persistent configuration issues

Command Examples

Basic erase of startup configuration

erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete

The command prompts for confirmation. Press Enter to confirm. '[OK]' indicates success. 'Erase of nvram: complete' confirms the operation finished.

Erase with forced confirmation (non-interactive)

erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete

Pressing Enter at the confirm prompt accepts the default (yes). The output confirms the erase operation completed successfully.

Understanding the Output

The output begins with a warning that all configuration files will be removed. The '[confirm]' prompt expects Enter to proceed. After confirmation, '[OK]' indicates the erase operation succeeded.

'Erase of nvram: complete' confirms the NVRAM filesystem is now empty. If the command fails (e.g., due to locked NVRAM), an error message like '%Error erasing nvram' appears. A successful erase means the router will boot with no startup configuration, prompting the initial configuration dialog on next reload.

Configuration Scenarios

Resetting a Router for Redeployment

A network engineer needs to repurpose a Cisco 4321 router from a production environment to a lab. The current startup configuration contains sensitive data and complex routing protocols that must be removed.

Topology

Router (GigabitEthernet0/0/0)---(GigabitEthernet0/0/0) Lab Switch

Steps

  1. 1.Step 1: Access the router via console or SSH and enter privileged EXEC mode: Router> enable
  2. 2.Step 2: Verify the current startup configuration exists: Router# show startup-config
  3. 3.Step 3: Erase the startup configuration: Router# erase startup-config
  4. 4.Step 4: Confirm the deletion (if prompted): [confirm]
  5. 5.Step 5: Reload the router to boot with factory defaults: Router# reload
  6. 6.Step 6: Confirm reload (if prompted): Proceed with reload? [confirm]
  7. 7.Step 7: After reboot, the router will enter initial configuration dialog (setup mode). Type 'no' to skip and enter CLI.
Configuration
! No configuration block needed; the command is executed in privileged EXEC mode.
Router# erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Router# reload
Proceed with reload? [confirm]

Verify: After reload, the router should prompt with 'Would you like to enter the initial configuration dialog? [yes/no]:'. Entering 'no' and pressing Enter will bring up the Router> prompt with no previous configuration.

Watch out: A common mistake is forgetting to reload after erasing startup-config; the router continues to run with the old configuration until reloaded. Always verify with 'show startup-config' after erase to confirm it is empty.

Password Recovery Procedure

A network administrator has lost the enable password for a Cisco 2811 router and needs to regain access. The standard password recovery process involves erasing the startup configuration to bypass the password.

Topology

PC (Console)---(Console) Router 2811

Steps

  1. 1.Step 1: Power cycle the router and send a break sequence (Ctrl+Break) within 60 seconds of boot to enter ROMmon mode: rommon 1>
  2. 2.Step 2: Change the configuration register to ignore startup-config: rommon 1> confreg 0x2142
  3. 3.Step 3: Reset the router: rommon 2> reset
  4. 4.Step 4: The router boots with no startup config. Enter privileged EXEC mode: Router> enable
  5. 5.Step 5: Copy the running config to startup config to preserve the current (default) config: Router# copy running-config startup-config
  6. 6.Step 6: Erase the startup config (which now contains the default config): Router# erase startup-config
  7. 7.Step 7: Reload the router: Router# reload
  8. 8.Step 8: After reload, the router boots with factory defaults, allowing you to set a new password.
Configuration
! ROMmon commands
rommon 1> confreg 0x2142
rommon 2> reset

! After boot
Router> enable
Router# copy running-config startup-config
Router# erase startup-config
Router# reload

Verify: After reload, the router should present the initial configuration dialog. Enter 'no' to skip, then set a new enable password using 'enable secret <password>'.

Watch out: A common mistake is not resetting the configuration register back to 0x2102 after password recovery; otherwise, the router will continue to ignore startup-config on subsequent boots. Always change the register back: 'config-register 0x2102' in global config mode.

Troubleshooting with This Command

When troubleshooting issues related to startup configuration, the `erase startup-config` command is often used as a last resort to recover from a corrupt or misconfigured startup config. Healthy output from `show startup-config` displays the full configuration file. Problem indicators include error messages like 'NVRAM corrupted' or 'Invalid configuration' during boot, or the router failing to boot properly.

If the router boots with a partial or no configuration, it may indicate that the startup config was accidentally erased or corrupted. In such cases, the engineer can use `erase startup-config` followed by `reload` to force a clean boot. However, before erasing, it is crucial to save a copy of the running config if the router is still operational.

A step-by-step diagnostic flow: 1) Check if the router boots with expected config by examining the startup config: `show startup-config`. 2) If the output shows 'startup-config is not present' or is garbled, the config may be missing or corrupt. 3) If the router is operational, copy the running config to a TFTP server as backup: `copy running-config tftp:`. 4) Then erase the startup config and reload. 5) After reload, the router will boot with defaults; you can then restore the backup if needed. Correlate with other commands: `show version` shows the configuration register; if it is set to 0x2142, the router will ignore startup config. `debug ip packet` may help if the issue is network-related, but for config issues, focus on `show startup-config` and `show running-config`. Common symptoms: router boots to 'Would you like to enter the initial configuration dialog?' indicates no startup config.

If the router boots but has no enable password, it may have been erased. Always verify the config register before assuming the startup config is lost.

CCNA Exam Tips

1.

CCNA exam tip: After 'erase startup-config', you must also 'reload' to apply the factory defaults; the running config remains until reload.

2.

CCNA exam tip: The command does not affect the running configuration; use 'write erase' as an alternative (same effect).

3.

CCNA exam tip: In the exam, you may be asked to reset a router to factory defaults; remember the two-step process: erase startup-config then reload.

4.

CCNA exam tip: The 'confirm' prompt expects Enter; typing 'no' cancels the operation.

Common Mistakes

Mistake 1: Forgetting to reload after erase; the router continues using the current running config until reboot.

Mistake 2: Confusing 'erase startup-config' with 'delete flash:config.text' — the latter deletes the file but may not clear NVRAM properly.

Mistake 3: Assuming the running config is also erased; it is not — you must explicitly 'reload' to clear it.

erase startup-config vs write erase

Both commands erase the startup configuration stored in NVRAM, causing the device to load factory defaults on next reload. They are often confused because they achieve the same goal, but originate from different eras of Cisco IOS development and have subtle differences in behavior.

Aspecterase startup-configwrite erase
ScopeErases startup-config from NVRAM onlyErases startup-config from NVRAM (also clears VLAN database on switches)
Syntaxerase startup-configwrite erase
ConfirmationPrompts for confirmation before erasingNo confirmation prompt; executes immediately
StatusModern recommended commandLegacy command, still supported in current IOS
ModePrivileged EXECPrivileged EXEC

Use erase startup-config when you want a safer, interactive removal with a confirmation prompt to prevent accidental erasure.

Use write erase when scripting automated tasks or working in environments where the older syntax is expected for compatibility.

Platform Notes

In IOS-XE (e.g., CSR1000v, ISR 4000 series), the `erase startup-config` command behaves identically to classic IOS. However, on some IOS-XE platforms, NVRAM is emulated, and the command may take slightly longer. The output is the same.

For NX-OS (Cisco Nexus switches), the equivalent command is `write erase` or `erase startup-config` (both work). On NX-OS, the command also clears the boot variables. On ASA (Adaptive Security Appliance), the equivalent is `write erase` which erases the startup configuration.

On IOS-XR (Cisco 9000 series), the command is `erase startup-config` but the syntax may require specifying the file system: `erase nvram:startup-config`. Additionally, IOS-XR uses a different configuration model (commit-based), so erasing startup config does not affect the running config until a reload. In IOS versions 12.x and earlier, the command prompts for confirmation by default; in 15.x and later, it may not prompt if the terminal is not interactive.

Always test in a lab environment. For CCNA/CCNP, the command is consistent across platforms, but candidates should be aware of these nuances for real-world scenarios.

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