If you have had any experience with Cisco switches or routers, you know there are situations where a factory reset of the device is needed.
Whether you want to reconfigure a device from scratch to get a clean configuration or repurpose a device to play a different role in the network, it’s always a good idea to first restore the router or switch to its factory default settings.
In this article, we’ll describe why this is important, and how this can be done.
Why perform a factory reset?
There are several reasons why it is important to perform a factory reset.
Repurposing Equipment
It is useful when you are taking devices from one part of the network and repurposing them for other uses.
Older distribution switches may be repurposed as access switches when newer higher-performance switches are procured to replace them.
Edge routers for your HQ may be moved to a branch office to make way for newer routers to substitute them.
Or you may have inherited several devices from a corporate merger or takeover, or an amalgamation of networks, thus requiring the reshuffling of equipment from place to place.
And keeping in mind that Cisco devices are known for their robustness and longevity, repurposing devices is an excellent way to maximize your ROI.
Removing bloated configurations
While performing their roles, administrators will add and modify configurations of devices, often disregarding, or simply not being aware of what previous or other admins may have configured.
Over time this can result in bloated configurations, with unnecessary commands often affecting network performance.
Resetting to factory defaults before configuration the device anew will ensure that all of these commands are removed, resulting in a fresh configuration that delivers better performance.
Security
Configurations will contain security information such as local usernames and passwords as well as network information including IP addressing, VPN configurations, and access lists, to name a few.
If you were to give an “unresetted” device to the admin of another department, anyone who can read the configuration will be able to glean information about your network, resulting in a possible security breach.
Factory resets should be performed whenever such devices change hands to purge any sensitive information from them, especially if they are moved across departments or other hierarchical entities.
The factory reset involves the “startup-config”
Performing a factory reset on a Cisco IOS router and a Cisco IOS switch are similar processes.
Consumer-grade network equipment, such as an Internet modem or an economical access point, usually has an external reset button which, if depressed for several seconds, will return the device to its factory default settings.
Cisco IOS devices are considered commercial-grade equipment, and most do not have such a button, primarily for security purposes.
So how are Cisco devices reset? Returning them to the factory default settings involves erasing the startup-config file and reloading the device.
Startup configuration
The startup-config file is a file that is contained within the Non-Volatile Random Access Memory (NVRAM) of the device.
While booting up, this file is copied into the RAM as the running-configuration file, and is used for all of its operations and functions.
If a device does not have a startup-config file in the NVRAM during bootup, the device will prompt the user with a setup utility or setup dialog.
This is an optional interactive configuration mode where the device asks a series of questions to guide the user through a basic configuration.
Based on the responses of the user, (or even the dismissal of the prompt), the device will generate a basic startup-config file. This file is then used for subsequent reboots.
Performing a factory reset
To perform a factory reset, simply delete the startup-config file, and reload the device, ensuring that the running-config is not saved in the process.
There are several ways to erase the startup-config file on both Cisco IOS switches and routers, and these methods are described below. The following configuration examples are the same for both IOS routers and switches.
The Cisco “write erase” command
The write erase command will erase the startup-config file from the NVRAM. The following shows the use of this command and the resulting prompts:
R1#write erase
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
*Dec 20 11:27:21.995: %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
R1#
Once this is done, you can then reload the switch like so:
R1#reload
System configuration has been modified. Save? [yes/no]: no
Proceed with reload? [confirm]
Make sure you answer “no” to the question shown, otherwise the running-config, which is still intact, will be copied to the startup-config, thus negating your factory reset.
The goal is to reset the device without its startup-config, and by taking these steps, this is exactly what we have done.
Once the reload is performed, the device will boot up, detect that it has no startup-config, and will go into the initial configuration dialog to configure the fundamental parameters of the device. You would see a prompt like this:
Would you like to enter the initial configuration dialog? [yes/no]:
The device has now been reset to its factory defaults and ready to be configured anew.
“erase startup-config” command
The erase startup-config command does exactly the same thing as the write erase command. Even so, it is a more explicit command, and more descriptive as it does exactly what the command says. The result, however, is exactly the same.
“erase nvram:” command
Now most modern IOS platforms do support both the erase startup-config and the write erase commands, however, these are considered deprecated.
They may or may not be phased out over the coming years as new devices are manufactured and programmed. The command that is newer, and generally preferred is the erase nvram: command.
The following example shows how this command can be executed:
R1#erase nvram:
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
As before, once this is done, you can then reload the router like so:
R1#reload
System configuration has been modified. Save? [yes/no]: no
Proceed with reload? [confirm]
Take Precautions
Whenever dealing with configuration files, deleting them, and modifying them, it is important to ensure that you are not destroying vital information and configurations.
Even if you are resetting a device to its factory defaults, it is best practice to always back up the startup-config that you will be deleting.
There may be information contained in the configuration file that may be useful to you in the future, such as passwords, security settings, or IP addressing schemes. There has been more than one occasion when I wished I had done that!
Conclusion
Resetting a Cisco IOS switch or router to its factory default settings is a crucial step in various scenarios, such as repurposing a device, removing bloated configurations, or improving security.
The simplicity of the process, coupled with the commands provided, ensures that even those with limited networking experience can perform these resets confidently.
This reset procedure not only helps in maintaining the optimal performance of your Cisco devices but also contributes to a more secure and manageable network infrastructure.
Related Posts
- Introduction to Cisco EEM (Embedded Event Manager)
- Monitoring Cisco Network Infrastructure: What to Look for in an Ideal Cisco Monitoring Tool
- Comparison of LLDP vs CDP on Cisco Networking Devices
- Comparison of BGP Confederations vs Route Reflectors
- What are BGP Confederations-Explanation and Discussion (With Cisco Example)