Cisco Router and Switch Password Recovery

password recovery itsg security

Password recovery on Cisco routers and switches can disrupt even the most organized networks. This guide equips you with proven methods to recover access efficiently, safeguarding your configurations while restoring control.

Password Recovery for Cisco Routers

Prerequisites:

  • Ensure a console connection is established with the router using a PC.

Steps:

  1. Connect to Console Port: Use a terminal application like PuTTY or Mobaxterm to connect to the router via the console port.
  2. Power Cycle the Device: Turn off the router and then turn it back on.
  3. Interrupt Boot Process: Hold down the MODE button as the router powers on. Keep it pressed for 10–15 seconds.
  4. Bypass Startup Configuration, Enter the following commands:

confreg 0x2142
boot

  • This bypasses the NVRAM and loads the device as if it were new, without any saved passwords.
  1. Access Configuration Mode, After the device boots:

enable
copy startup-config running-config
conf t
no enable secret
[Other Command]
config-register 0x2102
do write
reload

  1. Verify Configuration:
  • Use the show boot command to confirm changes.
  • Ensure the device boots into normal mode with the proper configuration.

Note: This method can also be applied for recovering Telnet, SSH, or other passwords.

Password Recovery for Cisco Switches (Old Version Switches)

Steps:

  1. Connect to Console Port: Connect to the switch using a console connection.
  2. Power Cycle: Disconnect and reconnect the power cable.
  3. Interrupt Boot Process: Hold down the MODE button for 10–15 seconds during boot.
  4. Enter ROMMON Mode, Run these commands:

flash_init
rename flash:config.text flash:config.old
boot

  • Allow the switch to boot fully (it will start as a fresh device).
  1. **Restore Configuration, Rename the configuration back:

rename flash:config.old flash:config.text
copy flash:config.text running-config
conf t
no username [username]
no enable secret
do write

  • If errors occur during this process, use:

enable
conf t
line 0
logging synchronous

  • Ensures system log messages are displayed in a synchronized manner, preventing interruptions to command input.

New Version Switches

Steps:

  1. Connect to Console Port: Establish a connection via console.
  2. Power Cycle and Interrupt Boot: Disconnect and reconnect the power cable, hold the MODE button for 10–15 seconds during boot.
  3. Modify Boot Parameters, Enter commands in ROMMON Mode:

flash_init
SWITCH_IGNORE_STARTUP_CFG=1
boot flash:packages.conf

  1. Recover Configuration, once booted:

copy startup-config running-config
[CHANGE_PASSWORD] or [REMOVE PASSWORD]
copy running-config startup-config
reload

  1. Restore Boot Mode:
  • Hold the MODE button again to enter boot mode, execute this commands:

SWITCH_IGNORE_STARTUP_CFG=0
boot flash:packages.conf

  1. Finalize, allow the switch to boot fully and disable manual boot:

no boot manual

Note: In some cases, it may be necessary to repeat the process multiple times to achieve successful recovery.

Troubleshoot Password Recovery in Cisco IOS and Cisco IOS XE Routers.

More information about CloudLinux.