Syed Jahanzaib Personal Blog to Share Knowledge !

November 8, 2016

Cisco Switch Howto Factory Default / Password Recovery


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

Requirements:

  • 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 one sample for my desktop. Different switches connect with different Bits per Second setting . Try to lower it to 9600 for some models.

hyperterminal.PNG

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

sw-power.jpg

  • Once the switch initialize itself (may take 1-2 minutes), 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:

sw-1

Once you see the

The password-recovery mechanism is enabled.

you can release the Mode button.

  • Now issue following commands to initialize flash and delete files which contains the switch configuration

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

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

 

boot

 

This will boot the switch and all of old / previous settings will be cleared.

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

Type no and continue with below ..

To add ip use following

en
config t
interface vlan 1
ip address 101.11.100.1 255.0.0.0
ip default-gateway 101.11.100.255
exit
exit
wr

sw-2.PNG

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

ping.PNG

 

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.

cisco-network-gui

You can download Cisco Network Assistant it from my google drive.

https://drive.google.com/drive/folders/0B8B_P2ljEc2xQlpvRUQ2QWVfR0E


 

TIPS:


Add ENABLE section Password

en
config t
enable secret zaib1234
exit
wr

Reboot Switch

wr mem
reload


Vlan1 is administratively down, line protocol is down

en
config t
interface vlan 1
no shut


Enable TELNET access

config
line vty 0 15
transport input telnet
password zaibtelnetpass
login
exit
exit
wr


Enable SSH access

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

*** 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
exit

*** 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:

sw-1

Now issue following commands one by one …

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

Now continue the boot process by following command

boot

Enter n at the prompt 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
enabled password zaib1234

*** Overwrite the existing vty password

line vty 0 15
password zaib1234

*** Overwrite the existing console password

line con 0
password zaib1234
exit
exit
wr mem
DONE !

Regard’s
Syed Jahanzaib

 

 

 

2 Comments »

  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:

WordPress.com Logo

You are commenting using your WordPress.com 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

Blog at WordPress.com.

%d bloggers like this: