Cisco – Clear Configuration from a Switch
by: Michael T. Durham

Sometimes we forget the login password on a Cisco switch or get one from someone and they have a password that you do not know.  What to do?  Not to worry, just clear out that configuration with the instructions below.

These instructions are designed for Cisco 1900, 2900, 3500, and 3700 series switches.  Other switch series may also be cleared with this method too.

You need to unplug the switch if it is currently powered up before we begin.

We assume that you have a terminal program such as TeraTerm, HyperTerm, SecureCRT or other terminal program configured for your COM port (usually COM1) and that you have the baud rate set to 9600,8,N,1.

Warning  If you do not see any output at all from the switch you are trying to remove the configuration from, the most likely problem is that someone has changed the baud rate from the default rate of 9600bps to something else.  Most times technicians change this speed to 115,200 so when the upgrade the switch’s IOS, it uploads much faster.  You will need to change your terminal program to match the switch’s.  Try using 115,200 first then work your way down.  If no speed works, check your computer and console cable on another Cisco device to be sure that your COM port is working and that your cable is good.
Step 1. – Connect the Console Cable to the switch

Plug the powder blue console cable into the RJ-45 console port on the back of the switch and the DB9 connector into your computer’s COM1 port or a USB to Serial adapter cable.

Clear Switch

Step 2. – Press and HOLD the Mode button on the switch and plug in the switch

While holding the MODE button, plug in the switch and keep holding the MODE button for about 20 seconds.  On some models the light above the MODE button will blink then stay on solid.  Once the light stays on solid or 20 seconds has passed, release the MODE button.  You will see that the switch boots up in the ROM mode.  You will see screen output something like this:

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:



Step 3. – Initialize the Flash Memory

At the switch: promptly enter the command flash_init and press enter

switch: flash_init

Initializing Flash…
flashfs[0]: 6 files, 1 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 7741440
flashfs[0]: Bytes used: 3726336
flashfs[0]: Bytes available: 4015104
flashfs[0]: flashfs fsck took 8 seconds.
…done initializing flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4

Step 4. – Check the files on the Flash Memory

Now we need to see what files are on the Flash Memory to see which ones need deleting.  Enter the dir command at the switch: prompt and press enter.

switch: dir flash:

Directory of flash:/

1  -rwx  270       <date>     env_vars
2  -rwx  456       <date>     config.text  
3  -rwx  616       <date>     vlan.dat  
4  -rwx  1048      <date>     multiple-fs
5  -rwx  3721126   <date>     c2950-i6k2l2q4-mz.121-22.EA11.bin
6  -rwx  110       <date>     info
7  -rwx  110       <date>     info.ver

4015104 bytes available (3726336 bytes used)

The files we are looking for are the config.text and the vlan.dat files.  We do not need to delete the vlan.dat file to get back into the switch, but if you are using the switch for the first time, it is a good idea to remove the VLans that are configured on the switch.

Warning  If you have VTP configured on your network and the switch is configured as a VTP server, you could have your VLans overwritten by this switch.  By deleting the vlan.dat file, you prevent this from happening.

Step 5. – Delete Files

To delete the config.text and vlan.dat del flash:config.text at the switch: prompt and press enter.  You need to confirm that you want to delete the file by pressing the y key and then pressing the enter key.

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

Next enter del flash:vlan.dat at the switch: prompt and press enter.

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


Step 6. – Confirm Deletion

Lastly, we need to confirm that the files have been deleted from your switch.  Enter the dir flash: command at the switch: prompt and press the enter key.

switch: dir flash:

Directory of flash:/

1  -rwx  270       <date>      env_vars
2  -rwx  1048      <date>      multiple-fs
3  -rwx  3721126   <date>      c2950-i6k2l2q4-mz.121-22.EA11.bin
4  -rwx  110       <date>      info
5  -rwx  110       <date>      info.ver

4016128 bytes available (3725312 bytes used)


As you can see, the config.text and vlan.dat files are no longer on the flash memory. You can boot the switch by pressing the b key and then pressing the enter key or unplug the switch and then plug it in again. Your switch will now come up and you can configure it to meet your needs.

After you have setup and tested this lab, please blog your experience below.

Thank You,

CTS Offical Logo 400x151

Leave a Reply