清空路由器所有配置,重启
Router#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
Router#reload
Proceed with reload? [confirm]
设置密码,并保存配置
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#enable password 123
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#wr
Building configuration...
[OK]
密码恢复
关闭路由器电源并重新开机,在路由器启动时,按【Ctrl+Break】键中断路由器的启动过程,进入rommon 模式。
rommon 1 > confreg 0x2142
rommon 2 > boot
......
--- System Configuration Dialog ---
Continue with configuration dialog? [yes/no]: no
此时已可以直接进入特权模式,将NVRAM中的配置复制到RAM中
Router>
Router>en
Router#copy startup-config running-config
Destination filename [running-config]?
429 bytes copied in 0.416 secs (1031 bytes/sec)
%SYS-5-CONFIG_I: Configured from console by console
重新设置密码,保存配置,重启。
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#enable password 123456
Router(config)#conf
Router(config)#config-register 0x2102
Router(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
Router#wr
Building configuration...
[OK]
Router#reload
Proceed with reload? [confirm]