Flattening a switch before re-deployment is one of those simple tasks that I always find myself having lookup on the web, so I thought I’d save myself some time in future and document it here.
Step 1.
Connect up your console cable and power on the switch, whilst holding down the “mode” button:
This interrupts 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:
Using driver version 1 for media type 1 Base ethernet MAC Address: 4c:30:2d:81:ef:80 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 2.
Initialize the flash file system with the command: flash_init
switch: flash_init Initializing Flash... mifs[2]: 10 files, 1 directories mifs[2]: Total bytes : 1806336 mifs[2]: Bytes used : 612352 mifs[2]: Bytes available : 1193984 mifs[2]: mifs fsck took 1 seconds. mifs[3]: 0 files, 1 directories mifs[3]: Total bytes : 3870720 mifs[3]: Bytes used : 1024 mifs[3]: Bytes available : 3869696 mifs[3]: mifs fsck took 0 seconds. mifs[4]: 5 files, 1 directories mifs[4]: Total bytes : 258048 mifs[4]: Bytes used : 9216 mifs[4]: Bytes available : 248832 mifs[4]: mifs fsck took 0 seconds. mifs[5]: 5 files, 1 directories mifs[5]: Total bytes : 258048 mifs[5]: Bytes used : 9216 mifs[5]: Bytes available : 248832 mifs[5]: mifs fsck took 1 seconds. -- MORE -- mifs[6]: 566 files, 19 directories mifs[6]: Total bytes : 57931776 mifs[6]: Bytes used : 28429312 mifs[6]: Bytes available : 29502464 mifs[6]: mifs fsck took 21 seconds. ...done Initializing Flash.
Step 3.
Delete the config.text file from the flash directory:
switch: del flash:config.text Are you sure you want to delete "flash:config.text" (y/n)?y File "flash:config.text" deleted
Step 4.
Delete the vlan.dat file from the flash directory:
switch: del flash:vlan.dat Are you sure you want to delete "vlan.dat" (y/n)?y File "flash:vlan.dat" deleted
Step 5.
Reboot the switch and you’re done:
switch: boot Loading "flash:c2960s-universalk9-mz.122-58.SE2.bin"... --- System Configuration Dialog --- Enable secret warning ---------------------------------- In order to access the device manager, an enable secret is required If you enter the initial configuration dialog, you will be prompted for the enable secret If you choose not to enter the intial configuration dialog, or if you exit setup without setting the enable secret, please set an enable secret using the following CLI in configuration mode- enable secret 0 <cleartext password> ---------------------------------- Would you like to enter the initial configuration dialog? [yes/no]: % Please answer 'yes' or 'no'.
Thanks for reading.
Rich
Follow Rich on Twitter
You are the best.
Thanks man. Much appreciated
Yes you are
it’s working good
Very good post. I absolutely appreciate this site.
Keep it up!
thank you very much!!
Thanks man!! You the best
Stopped a reboot to factory settings at 100% and 99%. Ugh! It’s a Gateway NetBook. Any ideas how to get it going again or finish the reboot progress?
Thanks much!
i’m and mohamad thnks you very much…..barzoo too
Legend mate, simple and effective!
many thanks
Excellent Article : I published a similar one when I got my first 2960 for my homelab
http://fatmin.com/2012/12/02/how-to-reset-cisco-catalyst-2960-back-to-factory-defaults/
Thanks for the comment and link ! you’ve got some great content on your blog there. reminds me I’ve not blogged for a few months now, so I need to get back into it!
Rich
Hi,
I want to use wireshark to monitor some calls but I don’t know how to config my cisco 2960 switch and I need help.
Thanks Man, much appreciate
Pingback: How to Reset Cisco Catalyst 2960 Back to Factory Defaults | Fatmin.com
NIC this works, with 0 problem
I have three 2960x switches that used to be stacked. I did the above procedure on all three but they still have remnants of the old config (i.e. Stack 3 still shows up as ‘stack 3’ during boot up and the interfaces are all still labelled ‘GigabigEthernet 3/0/1-52’ and on stack 2 they are gigabitethernet 2/0/1, etc.).
To clarify, the switches are not connected to each other in any way… Here is what I see at the end of the initialization sequence on what used to be switch3:
cisco WS-C2960X-48LPS-L (APM86XXX) processor (revision A0) with 524288K bytes of memory.
Processor board ID FOC1744Y0P1
Last reset from power-on
1 Virtual Ethernet interface
1 FastEthernet interface
52 Gigabit Ethernet interfaces
The password-recovery mechanism is enabled.
512K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address : C0:7B:BC:4B:83:00
Motherboard assembly number : 73-14191-03
Power supply part number : 341-0528-01
Motherboard serial number : FOC17430RHU
Power supply serial number : DCB174171XR
Model revision number : A0
Motherboard revision number : A0
Model number : WS-C2960X-48LPS-L
Daughterboard assembly number : 73-14200-03
Daughterboard serial number : FOC17426JNR
System serial number : FOC1744Y0P1
Top Assembly Part Number : 800-38006-01
Top Assembly Revision Number : B0
Version ID : V01
CLEI Code Number : CMMLP00ARA
Daughterboard revision number : A0
Hardware Board Revision Number : 0x05
Switch Ports Model SW Version SW Image
—— —– —– ———- ———-
* 3 52 WS-C2960X-48LPS-L 15.0(2)EX3 C2960X-UNIVERSALK9-M
Press RETURN to get started!
*Mar 1 00:00:26.067: Read env variable – LICENSE_BOOT_LEVEL =
Mar 30 01:27:38.150: %IOS_LICENSE_IMAGE_APPLICATION-6-LICENSE_LEVEL: Module name = c2960x_lanbase Next reboot level = lanbase and License = lanbase
Jan 11 23:40:18.275: in Switch 0. Cannot read pid from Flexstack module
Jan 11 23:41:15.597: %STACKMGR-4-SWITCH_ADDED: Switch 3 has been ADDED to the stack
Jan 11 23:41:17.160: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
Jan 11 23:41:17.160: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0, changed state to down
Jan 11 23:41:18.540: %SPANTREE-5-EXTENDED_SYSID: Extended SysId enabled for type vlan
Jan 11 23:41:22.238: %SYS-5-CONFIG_I: Configured from memory by console
Jan 11 23:41:22.333: %STACKMGR-5-SWITCH_READY: Switch 3 is READY
Jan 11 23:41:22.333: %STACKMGR-4-STACK_LINK_CHANGE: Stack Port 1 Switch 3 has changed to state DOWN
Jan 11 23:41:22.333: %STACKMGR-4-STACK_LINK_CHANGE: Stack Port 2 Switch 3 has changed to state DOWN
Jan 11 23:41:22.728: %STACKMGR-5-MASTER_READY: Master Switch 3 is READY
Jan 11 23:41:22.826: %SYS-5-RESTART: System restarted —
Cisco IOS Software, C2960X Software (C2960X-UNIVERSALK9-M), Version 15.0(2)EX3, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Wed 11-Sep-13 02:04 by prod_rel_team
Jan 11 23:41:24.168: %LINK-5-CHANGED: Interface FastEthernet0, changed state to administratively down
Jan 11 23:41:24.224: %LINK-5-CHANGED: Interface Vlan1, changed state to administratively down
Jan 11 23:41:27.037: %USB_CONSOLE-6-MEDIA_RJ45: Console media-type is RJ45.% Generating 1024 bit RSA keys, keys will be non-exportable…
[OK] (elapsed time was 1 seconds)
[OK]
Jan 11 23:41:39.729: %SSH-5-ENABLED: SSH 1.99 has been enabled
Jan 11 23:41:39.816: %PKI-6-AUTOSAVE: Running configuration saved to NVRAM
Hi Mike.
This is just a simple question about renumbering the switch in global config mode:
switch 3 renumber 1
The switch will keep it’s stack number and use it if stacked again, provided the number is not being used in the new stack it is connected to.
Brgds,
Rune
Very nice, got rid of my vlans I created and all other commands from when I was doing my lab setup that were left there even after wr erase was done. Thank you for posting an easy to follow post.
I have a problem .when I change the IOS from rommon I try to reload the switch but he stopped and not complet it,s boot as show.My switch is 2960S and I installed version is c2960-lanbasek9-mz.122-53.SE2.bin.
Using driver version 1 for media type 1
Base ethernet MAC Address: dc:a5:f4:0f:4a:80
Xmodem file system is available.
The password-recovery mechanism is enabled.
Initializing Flash…
mifs[2]: 0 files, 0 directories
mifs[2]: Total bytes : 1806336
mifs[2]: Bytes used : 512
mifs[2]: Bytes available : 1805824
mifs[2]: mifs fsck took 2 seconds.
mifs[3]: 0 files, 1 directories
mifs[3]: Total bytes : 3870720
mifs[3]: Bytes used : 1024
mifs[3]: Bytes available : 3869696
mifs[3]: mifs fsck took 2 seconds.
mifs[4]: 5 files, 1 directories
mifs[4]: Total bytes : 258048
mifs[4]: Bytes used : 9216
mifs[4]: Bytes available : 248832
mifs[4]: mifs fsck took 0 seconds.
mifs[5]: 5 files, 1 directories
mifs[5]: Total bytes : 258048
mifs[5]: Bytes used : 9216
mifs[5]: Bytes available : 248832
mifs[5]: mifs fsck took 1 seconds.
mifs[6]: 7 files, 1 directories
mifs[6]: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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
File “flash:c2960-lanbasek9-mz.122-53.SE2.bin” uncompressed and installed, entry point: 0x3000
executing…
How to exit this executing mode and how to troubleshooting.Please
help me!!!!
Regards
Nilar
as far as l know that is a normal procedure…why would you want to interrupt it?? what really do you want
thanks….it’s working
Pingback: Reset a Cisco 2960 Switch To Factory Default Settings | not the network | Mazurland
Dear,
I have one cisco 2960x series switch, when i let power it up the switch is frequently resetting every 10 min once, what is the solution for this unknown issue
I have a problem .when I change the IOS 2960TTL from hiper terminal،page http not working.Please give me advice!!!!؟؟؟ Thank you
Nice post! Simple and descriptive!
Rune
Great job. Thanks!
Thank you very much, i think this is the best way resetting the cisco switch catalyst if we forgot the pass.
You save my life, thanks a lot 🙂
Thanks Rich for increasing the little knowledge I have for resetting these type switches.
Great !! Its working
woooow this is dope work ..
Nice Post and its been executed.
Thanks.
Regards,
Vinay
Thanks a lot saved my a** in the office.
Thanks a lot!
Maybe for interest:
-it was running for me only with Serial (on PC) to Lan (blue console RJ45 on the left side below)
(I wasn’t able to see the GUI while using the USB to MiniUSB-Console Cable on top of the switch)
-I had pressing the little mode button for 35 seconds.
Very good information..thanks for sharing with us
Pingback: 2960x switch resetleme
Why drop into rommon to do this? Much simpler to do it from standard exec mode
Switch#write erase
Switch#delete vlan.dat
the scenario I was thinking with this is when you don’t have the user id and password to log on in the first place
Rich
Pingback: Full Factory Reset of Cisco 2960 Switch: Adventure Time | whatnottodo
Perfeito….
Funcional normalmente apos os procedimentos..
Valeu!!!!
Thank you very much.
Does anyone know how to copy or backup the config.text file from switch: mode?
thank youuuu so muchhhh!
Brilliant! Thank-you for your post. I did notice that I needed to release the button after seeing the line about the password-recovery before the rest would appear.
I have tried factory reset to switch 2960x series but after completion console mode password not removed.
It always ask to enter console password.
I have done it by pressing mode button before switch powered on, then enter command flash_init , then try to delete config.text then says not present, then delete vlan.dat , it runs then enter command boot, after that it again ask console password.
Kindly help….
That was just awesome thank youuuuu
Can anybody help me with this?
I already deleted the config.text and vlan.dat but it shows me this after I reboot.
I want to configure with a clean slate installation.
Jun 12 07:21:13.702: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
Jun 12 07:21:13.702: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0, changed state to down
Jun 12 07:21:15.541: %SPANTREE-5-EXTENDED_SYSID: Extended SysId enabled for type vlan
Jun 12 07:21:38.134: %STACKMGR-5-SWITCH_READY: Switch 1 is READY
Jun 12 07:21:38.134: %STACKMGR-4-STACK_LINK_CHANGE: Stack Port 1 Switch 1 has changed to state DOWN
Jun 12 07:21:38.134: %STACKMGR-4-STACK_LINK_CHANGE: Stack Port 2 Switch 1 has changed to state DOWN
Jun 12 07:21:38.455: %STACKMGR-5-MASTER_READY: Master Switch 1 is READY
Jun 12 07:21:38.462: %SYS-5-RESTART: System restarted —
Cisco IOS Software, C2960X Software (C2960X-UNIVERSALK9-M), Version 15.2(2)E6, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2016 by Cisco Systems, Inc.
Compiled Fri 16-Dec-16 21:27 by prod_rel_team
Jun 12 07:21:40.451: %LINK-3-UPDOWN: Interface FastEthernet0, changed state to down
Jun 12 07:21:41.454: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0, changed state to down
Jun 12 07:21:42.548: %USB_CONSOLE-6-MEDIA_RJ45: Console media-type is RJ45.
Hope to hear from anyone.
Best regards,
Ronald
I love you.
LOL thanks Mike!
My buddy did give me an idea though, which didn’t really apply to me but would apply to someone not wanting to lose their config. Instead of deleting config.txt and vlan.dat, you could rename them, config.old and vlan.old, then when you log back into the switch, go into privileged mode, then rename those files back to their original config.txt and vlan.dat. Since you’re already in privileged mode, you can then get rid of or change the passwords and/or settings however you like. A good reason to make sure no one has physical access to your switch.
Very good point. Never tried this. Thanks for the comment
Thank a million
Pingback: Reset Cisco Switch to Default | IT: One Step At A Time
User Access Verification
Username: cisco
Password:
% Authentication failed.
thank you.it is helping
Thanks so much for the info, you save me alot.
Pingback: Setting up a Cisco 2960 Managed Switch – James Mutch Tech Support
Great post. It helped me to reset my cisco 2960.
Cheers Rich,
Hope you are keeping well !!
Phil.
All good thanks Phil! Hope all is well with you too 🙂
it worked perfectly on this old 2960G that our client replaced and we are now using in the lab environment.
thank you very much for this post.
Tried this on two different Cisco 2960G switches. When the switches rebooted, it promptly asked for a password (fortunately, it was CISCO. At the user mode (switch>) it will not execute a flash_init command! It will not allow the deleting of the config.txt file either! I thought that these instruction would reset the switch to factory defaults? If memory serves me correct, Cisco switches DO NOT HAVE PASSWORDS!
VERY disappointed that these instructions do not do what they clain to do!
Oh, these instructions do exactly what they claim to do, perfectly if I may say so…!!
Good job…
Thanks for the comment!
its working thanks
Thanks a lot. you are the best!
Will this also delete the current startup/running config on the switch?
yes, reset to factory defaults
It is working thank you very much.
Best regards,
Myrza
Kazakhstan, Atyrau
Thank you
Well I sincerely liked studying it. This information offered by you is very useful
for good planning.
Pingback: How to Reset a Cisco 3650 Catalyst Switch - Learn-IT [Solve IT]
Thank you for this.. You are the best!
What would you recommend if the config.text and vlan.dat or read-only after this process? Cant seem to figure out how to get around this?
sorry should be if both are read-only. I can not remove either of them.
how to creat 1 vlan in all 48 port swich
good one.. Thanks
Great tutorial. I tested the method on Packet Tracer and the only problem I stumbled upon was with the “del flash:” as the console said the command was invalid. Instead, I used the complete command “delete” along with the rest and it went perfectly.
Thanks for the content!
Thanks friend , what is exactly this procedure did ? how can i follow you? better than rommon mode!!!!!!!!!!!!
What happens if I press and hold the Button Mode on a Stack Setup? Will it erase the Whole Stack or just the pressed Switch? Thanks
Great instructions. Worked perfectly.
The post is very helpful ….it has worked
J’ai un commutateur Catalist Express 500 séries, je voulais réinitialiser au mode usine mais j’accède à l’interface par Putty malheureusement je n’ai pas la main sur le commutateur.
thanks, still working..
Hi rich.
I missed my login password
I want to reset password without reboot the switch .Help me please
thanks !!!!! works like a charm 🙂
Thanks a lot mate. Worked. 🙂
Very simple and good post
once remotely use this instead:
Switch# write erase
Switch# delete flash:vlan.dat
Switch# reload
great, worked like a charm!