Do you know how to reset a Cisco switch to factory defaults w/wo CLI? In this tutorial, you will learn the Cisco IOS commands used to clear all switch configurations with or without CLI/console port and whether you know the enable password.

Also, you will learn how to reset a Cisco 2960 switch back to factory settings manually without knowing the enable password and using the console cable. This guide applies also to the 2940, 2950, 2955, 2900-XL,3550, 3500-XL, 3560, and 3750 Cisco Catalyst switches.

Resetting a Cisco catalyst switch to factory defaults requires deleting the startup configuration and vlan.dat files. One file is stored in NVRAM, while the other file is located in flash memory.

How to Reset a Cisco Switch to Factory Defaults Using the CLI Interface

If you can log in to the switch’s CLI interface and access enable mode, you can wipe all the switch’s configurations (startup and VLAN).

The steps to achieve this task are the same on almost every Cisco switch running Cisco IOS software. To reset the switch to factory settings, follow these steps:

Step 1. Connect to the switch’s CLI interface through the console port, SSH, Telnet, or any other means.

Step 2. Issue the write erase command in enable mode to remove the startup configuration file. You can also use the erase startup-config command. It does the same thing.

SW1# write erase
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram

Step 3. Issue the delete flash:vlan.dat command to remove all remaining configured VLANs. Depending on the switch’s VLAN configuration, some VLANs may be saved in the startup configuration file, while others are saved in the vlan.dat file.

SW1# delete flash:vlan.dat
Delete filename [vlan.dat]?
Delete flash:/vlan.dat? [confirm]

SW1#

Step 4. Issue the reload command in enable mode to reboot the switch.

How to Reset a Cisco Switch to Factory Defaults Using the Command Line Interface Without Password

Step 1. Connect your computer to the switch using the console cable, and then power the switch on.

Step 2. While the Cisco switch is booting, press and hold the Mode button until the switch interface displays the following output:

Xmodem file system is available.
The password-recovery mechanism is enabled.
The system has been interrupted prior to initializing the
flash filesystem. The following commands will initialize
the flash filesystem, and finish loading the operating
system software:
flash_init
boot
switch:

Step 3. Issue the flash_init command to initialize the flash file system.

switch: flash_init
Initializing Flash...
mifs[2]: 10 files, 1 directories
mifs[2]: Total bytes : 2917447
mifs[2]: Bytes used : 643463
mifs[2]: Bytes available : 2204095
mifs[2]: mifs fsck took 1 seconds.
mifs[3]: 0 files, 1 directories
mifs[3]: Total bytes : 4981831
mifs[3]: Bytes used : 1024
mifs[3]: Bytes available : 4970707
mifs[3]: mifs fsck took 0 seconds.
mifs[4]: 5 files, 1 directories
mifs[4]: Total bytes : 369159
mifs[4]: Bytes used : 9327
omitted output

Step 4. Issue the del flash:config.text command, type in the letter “y”, and then hit Enter to wipe the switch configuration.

switch: del flash:config.text
Are you sure you want to delete "flash:config.text" (y/n)? y
File "flash:config.text" deleted

Step 5. Enter the del vlan.dat command, type in the letter “y”, and then hit Enter to remove the VLAN configuration.

switch: del flash:vlan.dat
Are you sure you want to delete "vlan.dat" (y/n)? y
File "flash:vlan.dat" deleted

Step 6. Reboot the switch using the boot command.

switch: boot
Loading "flash:2960-lanbasek9-mz.150-2.SE4.bin"...
omitted output

How to Reset a Cisco Switch to Factory Default Using the Mode Button

Resetting a stackable Cisco switch, like Cisco Catalyst Switch 2960 series, to factory settings manually is a super easy task.

All you need to do is hold down the switch’s mode button for 10 seconds. In this case, the switch’s lights start to blink, and then all switch configurations are restored back to their factory settings.

Here is a video that demonstrates this procedure.

Finally, this method does not work on Cisco switches that do not have the mode button like the chassis-based switches.

151 Labs to Help You Pass the CCNA Exam and Make Yourself More Competitive in The Job Market. Download Now!

Related Lessons to How To Reset a Cisco Switch to Factory Defaults

Conclusion

I hope this blog post helps you learn something.
Now I’d like to turn it over to you:
What did you like about this tutorial?
Or maybe you have an excellent idea that you think I need to add.
Either way, let me know by leaving a comment below right now.

Mohamed Ouamer
Mohamed Ouamer is a computer science teacher and a self-published author. He taught networking technologies and programming for more than fifteen years. While he loves to share knowledge and write, Mohamed's best passions include spending time with his family, visiting his parents, and learning new things.