关闭路由器电源并重新开机,当控制台出现启动过程,赶快按【Ctrl+Break】键中断路由器的启动过程,进入 rommon 模式,如下:
System Bootstrap, Version 12.4(1r) [hqluong 1r], RELEASE SOFTWARE (fc1)
Copyright (c) 2005 by cisco Systems, Inc.
Initializing memory for ECC
c2821 processor with 262144 Kbytes of main memory
Main memory is configured to 64 bit mode with ECC enabled
Readonly ROMMON initialized
rommon 1>confreg 0x2142
//改变配置寄存器的值为 0x2142,这会使得路由器开机时不读取 NVRAM 中的配置文件 。
rommon 2 > i
//重启路由器。路由器重启后会直接进入到 setup 配置模式,用【Ctrl+C】或者回答“n” ,退出 setup模式。
Router>enable
Router#copy startup-config running-config
Destination filename [running-config]?
661 bytes copied in 0.625 secs
//把配置文件从 NVRAM中拷贝到 RAM 中,在此基础上修改密码。
R2#configure terminal
R2(config)#enable password cisco
//以上把密码改为自己的密码,如果还配置别的密码则一起把它们修改了。
R2(config)#config-register 0x2102
//以上把寄存器的值恢复为正常值 0x2102
R2(config)#exit
R2#copy running-config startup-config Destination filename [startup-config]?
Building configuration...
[OK]
R2#reload
//以上是保存配置,重启路由器,检查路由器是否正常