I have recently been purchasing some new routers for my lab and I find myself having to do the password recovery procedure to gain access. In all truthfulness, its more of a “get access and wipe the router” sort of procedure however I usually copy off the config off before wiping just out of pure curiosity. So here’s what I do….
1 – Connect to the router with your console cable
2 – Power up the router and start pressing the ‘Break’ key on your keyboard
3 – If the router detects you pushing the ‘Break’ key it should put the router into ROMMON
4 – When the router enters ROMMON mode you should be presented with a ‘rommon’ numbered prompt. Enter the following commands…
monitor: command "boot" aborted due to user interrupt
rommon 1 > confreg 0x2142
You must reset or power cycle for new config to take effect
rommon 2 > reset
Essentially this tells the router to ignore its startup-config when booting. The reset command reboots the router.
5 – When the router finishes loading you should receive the standard ‘first boot’ prompts asking you about entering the initial configuration dialog. Say no to any prompts.
6 – At this point, I usually plug a ethernet interface on the router into my network and configure an IP address on the router so that I can copy the current config off. Its important to note here that all we did was tell the router to ignore it’s startup config. Its still fully intact at this point.
Router# config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)# int faste0/0
Router(config-if)# ip address 10.20.30.23 255.255.255.0
Router(config-if)# no shut
Router# copy startup-config tftp
Address or name of remote host ? 10.20.30.51
Destination filename [8772106002209363-confg]? 1841-Original-Config
2666 bytes copied in 3.104 secs (859 bytes/sec)
7 – Now that we have a good copy of the original config I reset the config register, wipe nvram, and reload the router. When it comes back online it will be like a brand new router.
Router# config t
Router(config)# config-register 0x2102
Router(config)# write erase
*May 12 23:00:00.891: %SYS-5-CONFIG_I: Configured from console by console
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
Erase of nvram: complete
*May 12 23:00:10.531: %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvr
System configuration has been modified. Save? [yes/no]: n
Proceed with reload? [confirm]
Im sure there are tons of documents out there that tell you how to do this, it just helps me remember when I write it all down. It should be noted that this is usually used as a password recovery procedure. In that case the startup-config is copied in the running-config after you enter enable mode. Once the startup-config is loaded you can enter config mode and reset the enable and line passwords since you were in enable mode prior to loading the original config.