实际工作中,由于各种不可预见的原因,路由密码或IOS文件有可能丢失或破坏,不管怎样,设备配置文件的预先备份是非常重要的,做为一名网工,也是极有可能遇到的。密码的恢复相对简单,但不同的设备有不同的方法,下面一起来做这个试验。
 实验环境:全部采用真设备,模拟器无法采用此方法恢复
 试验拓扑:
实验步骤:
1.在路由器R1上配置密码
Router>en
Router#conf t
Router(config)#no ip domain-lookup
Router(config)#lin con 0
Router(config-line)#logg s
Router(config-line)#exit
Router(config)#ho R1
R1(config)#enable password fjshfflsdmf --故意设置一个自已不记得的密码。
R1(config)#exit
R1(config)#wr   --保存配置
退到用户模式,重新进入特权模式,密码错误,不能进入:
2.路由器密码恢复
关闭路由器电源,等会重新开机,当控制台出现启动过程时,按下<Ctrl+Break>键,终止启动过程,进入rommon模式。
rommon 1>config 0x2142   将配置寄存器的值改为0x2142,使路由器开机时不读NVRAM的配置文件
rommon 2>i   重启路由器。路由器会直接进入Setup模式
 
Router>en
Router#copy startup-config running-config   将配置文件从NVRAM复制到RAM,在这修改密码
Destination filename [running-config]?
581 bytes copied in 1.160 secs (501 bytes/sec)
R1#conf t
R1(config)#enable password cisco   将密码改为自已的密码
R1(config)#config-register 0x2102  将配置寄存器值改为正常的0x2102
R1(config)#exit
R1#copy running-config startup-config   保存更改后的配置
Destination filename [startup-config]?
Building configuration...
[OK]
R1#reload  重启路由器,看看是否恢复正常!