Thursday, May 7, 2009

Cisco Catalyst Switch Password Recovery

Hi again Folks.... Well there are too many reasons you might need to gain access to a Cisco Switch - some are legal and some are not... Well lets just say your old network administrator got fired and he aint coughing up the passwords or maybe you were screwing around with a Switch and setup the passwords in the wrong or created the username and password wrong and you saved the configuration and your now locked out? (this happens to us all)..... NOT!!!!

Anyways..... There is two ways to do this... 1 just flash/destroy the config and spend HOURS reconfiguring the switch.... or there is the Correct way... Backup the config - Wipe it, Reload it and setup a new password (correctly this time). I say we go with option number 2? I thought you would agree!! Here's how its done...


*NOTE: This is slightly different depending on the model of the switch - for this demo we are using a Cisco 3560"


1) Getting back inside the switch......
First thing is first, We need to get back inside the switch do be able to do SOMETHING at all.

a) Pull the power Cable out of the switch so it is turned OFF..... Attach a console cable to the switch and open your terminal software like Hyperterminal or PuTTY, Use the following settings to connect to the switch;
  • Bits per second (baud): 9600

  • Data bits: 8

  • Parity: None

  • Stop bits: 1

  • Flow Control: Xon/Xoff



b) Hold the button on the front of switch, This part is easy to do since most cisco switches have only 1 button in the front anyways there should be no confusion... While holding the button plug the power cable back in which will turn the switch on...

c)
Release the button after approximately 15 seconds when the SYST LED turns solid green located on the front of the switch. When you release the Mode button, the SYST LED should blink green... You will know if it worked or not because you will get a Switch: Prompt on your Telnet/PuTTY/Hyperterm Window


2) Backing up the Configuration of the Switch
OK, so now we are back inside the switch but we are in a very very basic mode...We will need to load a couple of things inside the switch then we can backup our configuration...

a) Enter the Command below as shown; This will initialize some basic features
switch: flash_init

b) Enter the next command shown below; This will load another key feature.

switch: load_helper

c) Enter yet another command; This will show you the files saved on your switch - we are looking at the files so we can find your config file and rename it.
(ENTER EXACTLY AS SHOWN w/ the COLEN)
switch: dir flash:

d) Now you should see a file most likely called
config.text we need to rename this file so it will be safe and we can write a new blank config without losing our current configuration
(TYPE EXACTLY AS SHOWN; IF THIS DOES NOT WORK TRY AGAIN YOU PROBABLY TYPED IT WRONG)

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

e) Now BOOT up the switch in normal mode by typing:

switch: boot


3) Restoring the configuration and setting up a password (ALMOST DONE!)

Now you will see a few prompts offering to do a setup wizard for your brand new switch - this is normal since we renamed the configuration file the switcth created a blank clean new configuration.. Deny the wizards and prompts and get yourself back to the good'ol SWITCH: prompt.

a) Get back into "Enable Mode"
Type switch: enable
now your prompt should like like switch# instead of switch:

b) Time to restore the configuration we backed up;
Type Switch# rename flash:config.old flash:config.text
PRESS ENTER if you are prompted with "Destination filename [config.text]"

c) Great lets save it!
Type Switch# wr
"WR" will write the configuration and save what you just did...

d) OK after all that hard work we finally are back inside our switch and the configuration is restored..... Now you need to setup a user name and password... Go ahead and do this... if your not sure how to do this;

Type Switch# conf t
Type Switch(config)# username admin privilege 15 secret 5 yournewpassword

Explained: username Your User name follows
Privilege you want this to be 15 so you have FULL admin rights.
secret 5 yournewpassword - this will ensure your password is Encrypted.

e) Now reboot and your done!
Type Switch(config#) end
Type Switch# reload
Type ENTER TO CONFIRM

BOOOOOYA!!!!

Hope this helps.... You can now login to the switch with your username and password you put in!


Enjoy.