Access Your Online Course Anytime, Anywhere!

HomeTech BlogCisco Switch Recovery and Factory Reset

Cisco Switch Recovery and Factory Reset

Do you need to configure a Cisco switch and don’t know the old password?

This is how you get in to a  Cisco switch config if you don’t know the password or want to erase the configuration and reset back to factory settings. I would always reset any Cisco device before selling it or reusing old equipment.

putty setup
Connect to the Cisco Equipment using Putty

Connect to the switch via console with Putty. If you have issues connecting check your USB port number in device manager.


Cisco Switch Password Recovery Procedure

  1. Press and hold the mode button while powering on.  You can release the button when you get to the switch: command prompt.

Boot Sector Filesystem (bs) installed, fsid: 2
Base ethernet MAC Address: c4:71:fe:2c:2e:00
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:

2. Initialize the flash file system with the command ‘flash_init’

switch:flash_init
Initializing Flash…
flashfs[0]: 528 files, 19 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 32514048
flashfs[0]: Bytes used: 10419200
flashfs[0]: Bytes available: 22094848
flashfs[0]:
flashfs fsck took 11 seconds.
 …done Initializing Flash.

switch:

3. Let’s see what files are in flash with the command ‘dir flash:’

switch: dir flash:

Directory of flash:/

2 -rwx 916 <date> vlan.dat
5 drwx 192 <date> c2960-lanbase-mz.122-25.SEE1
620 -rwx 5488 <date> config.text
621 -rwx 5 <date> private-config.text

24800256 bytes available (7713792 bytes used)

If you want to keep the config and bypass the password we have to rename the config.text file, then boot up and then reload it afterwards. It’s quite simple to complete.

4. OK, now rename the config.text so we can use it later.

switch: rename flash:config.text flash:config.text.old

Let’s reboot this sucker. It will now boot up in factory default setting with no config.

switch: boot

Loading “flash:c2960-lanbase-mz.122-25.SEE1/c2960-lanbase-mz.122-25.SEE1.bin”…
@@@@@@@@@@@@@ . . .

5. We change the name of the config.text again.

Switch> enable

Switch# rename flash:config.text.old flash:config.text

Destination filename [config.text]? <Enter>

Nearly there now….just copy the config to the running config.

Switch# copy flash:config.text system:running-config

Destination filename [running-config]?<Enter>

That’s it. You now have bypassed the password and can look and change the config. You can also change the password to something you can remember.


Cisco Switch Factory Default Procedure

To just wipe the switch back to factory default is basically the same procedure.

switch: dir flash:

Directory of flash:/
2 -rwx 916 <date> vlan.dat
5 drwx 192 <date> c2960-lanbase-mz.122-25.SEE1
620 -rwx 5488 <date> config.text
621 -rwx 5 <date> private-config.text

24800256 bytes available (7713792 bytes used)

Delete the config.text and vlan.dat files.

switch:del flash:config.text
Are you sure you want to delete “flash:config.text” (y/n)?y
File “flash:config.text” deleted
switch:del flash:vlan.dat
Are you sure you want to delete “flash:vlan.dat” (y/n)?y
File “flash:vlan.dat”
switch:boot

That’s it. Just boot the switch back up to check the config has been deleted and you are done!

You May Also Like

Fiber optic communication is the backbone of modern digital networks, known for its efficiency and high-speed data transmission capabilities. However,...
Unraveling RS232 RS232, or Recommended Standard 232, is a long-standing serial communication protocol used for decades to facilitate communication between...
In the ever-evolving landscape of wireless technology, IEEE 802.11be, known as Wi-Fi 7, is the latest amendment to the IEEE...