Syed Jahanzaib Personal Blog to Share Knowledge !

November 8, 2016

Reset/Password Recovery for Cisco Switch

Following is a quick method to reset Cisco switch to factory default settings. This method can also be used to recover password.


  • Cisco Switch
  • Console Cable
  • PC/Laptop with Serial Port

Method#1 – Reset Everything – Factory Default

  • Connect your console cable from the switch Console port to PC/Laptop serial Port.
  • Open the HyperTerminal application, and select settings as per your hardware. Following is configuration for Cisco 3750 Model.

    Different switches connect with different Bits per Second setting .
    For Cisco 2950 Model try to lower it at 9600.


  • Power Off the switch / Now hold the MODE button on the switch and power ON the switch.


  • Once the switch initialize itself (may take 1 minute for 3750, and for 2950 it generally requires 5-6 seconds to hold mode button. ), This will interrupt the boot process before the Flash file system can initialize, and after a short while (continue holding the “mode” button) you will see the following prompt:


Once you see the

The password-recovery mechanism is enabled.

you can release the Mode button.

  • Press enter few times to make sure you get the prompt. Now issue following commands to initialize flash and delete files which contains the switch configuration

del flash:config.text
del flash:vlan.dat

Th eoutput may look a like following


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" not deleted -- no such file or directory


Once its done, you may continue booting the switch which will allow you to do any configuration of your choice.


This will continue booting the & after a while it will ask you following

Would you like to enter the initial configuration dialog? [yes/no]:

Type no and continue with below ..

Adding IP to default Vlan 1 interface

To add ip use following

config t
hostname zaib-switch
interface vlan 1
ip address
ip default-gateway
# Following is important, as vlan1 may be in shut status after ip config, so enable it
no shut
copy running-config startup-config
# When it will ask "Destination filename [startup-config]?" just press ENTER

Connect ethernet cable to the switch port and see the ping result.


Now you will be able to connect with the switch using IP.

Cisco configuration assistant software is the best GUI tool to configure the switch with ease and it will save you from remembering all the commands. Although command is more powerful in most cases but still GUI is feasible for most beginners.


You can download Cisco Network Assistant and Hyper-Terminal it from my google drive.


General Commands:

Show ALL Interfaces Status

at ENABLE section, use this command to get all ports status

show interfaces status

To show Ip addresses and interface status

show ip interface brief

To show vlan details (via enable mode)

show vlan

Add ENABLE section Password

config t
enable secret zaib1234

Reboot Switch


Port is Down/Shutdown / Vlan1 is administratively down, line protocol is down

config t
interface vlan 1
no shut

Enable TELNET access

config t
line vty 0 15
transport input telnet
password zaibtelnetpass

Enable SSH access

*** Set hostname and domain-name
config t
hostname cisco-switch
ip domain-name

*** Generate the RSA Keys
crypto key generate rsa
“How many bits in the modulus [512]: 1024”

*** Set Up the Line VTY configurations
transport input ssh
login local
password zaib1234

*** Set the console line
line console 0
logging synchronous
login local

*** Create the username password
config t
username zaib password zaib1234
enable secret zaib1234
service password-encryption

Method#2 – Password Recovery Only:
(While Keeping existing running configuration intact)

  • Connect Hyperterminal with the switch using console cable. [as mentioned in the beginning of this guide]
  • Power ON the switch while pressing mode button, one you see the “The password-recovery mechanism is enabled.”

More example for switch models:


Now issue following commands one by one …

dir flash:
rename flash:config.text flash:config.old
(The config.text file contains the password)

Now continue the boot process by following command


When you see the following dialogue

Would you like to enter the initial configuration dialog? [yes/no]:

Enter n to abort the initial configuration dialog.

Now rename the config.old file to config.text so that we can get our existing settings restored , and still let us change the password

rename flash:config.old flash:config.text
Press enter when ask for destination file name

Now save the config in running-config so that switch must load all the settings on next boot

copy flash:config.text system:running-config
Press enter when ask for destination file name

Changing Password …

*** Overwrite the existing secret/password

conf t
enable secret zaib1234
enable password zaib12345

### Overwrite the existing vty password
line vty 0 15
password zaib1234

### Overwrite the existing console password
line con 0
password zaib1234
copy running-config startup-config

Syed Jahanzaib



  1. There is any way to recover the password without any configuration loses …?


    Comment by yssir — November 9, 2016 @ 3:07 AM

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: