实验步骤:
1
.
加密,验证并保存。
Router#confi t
Router(config)#enable secret cisco
//
给进入特权模式加密为
cisco
Router(config)#exit
Router#exit
Router>en
Password:
//
这时需要密码。输入
cisco
是不显示的
Router#
Router#copy running-config startup-config //
保存配置文件
Destination filename [startup-config]? //
问目的文件名是否确认
startup-config
按回车确认
Building configuration...
[OK]
//
保存完毕
Router#sh startup-config //
查看保存的配置文件
enable password 5 $1$np61$k3BwEp1SRYu/itZtsv5Aj.
//
密码
2
.
查看寄存器值,改寄存器值并重启。
Router#sh version
Cisco Internetwork Operating System Software
IOS (tm) 2500 Software (C2500-IS-L), Version 12.3(18), RELEASE SOFTWARE (fc3)
System image file is "flash:c2500-is-l.123-25.bin"
16384K bytes of processor board System flash (Read ONLY)
Configuration register is 0x2142
//
寄存器值是
2142
,所以不加载配置文件。
Router#confi t
Router(config)#config-register 0x2102
//
改寄存器值。为什么要改呢?因为寄存器
2142
在重启时不加载配置文件,这样就谈不上密码破解。所以要成
2102
加载配置文件。
Router(config)#^Z
Ctrl+Z
Router#sh version
Cisco Internetwork Operating System Software
IOS (tm) 2500 Software (C2500-IS-L), Version 12.3(18), RELEASE SOFTWARE (fc3)
System image file is "flash:c2500-is-l.123-25.bin"
16384K bytes of processor board System flash (Read ONLY)
Configuration register is 0x2142 (will be 0x2102 at next reload)
//
下次重启时寄存器值是
2102
Router#reload //
重启
System configuration has been modified. Save? [yes/no]: yes
//
系统配置文件更改问你是否保存
yes
保存。
3
.
进入
rom monitor
模式更改寄存器值。
Router>en
Password: //
重启后需要密码,如果我密码不知道,怎么办?就要想办法破解。大家都知道寄存值
2142
是不会加载配置文件。现在就想办法改寄存器值。按电源重启按
Ctrl+Break
进入
rom monitor
模式
>
//rom monitor
模式
>o/r 0x2142
//
在
rom monitor
改寄存器值
>i
//
在
rom monitor
输入
i
重启
4
.
删掉密码并保存。
Router>enable
Router#
//
这时候不再需要密码
OK
了
Router#copy startup-config running-config //
先把配置文件
COPY
出来,为避免丢失配置文件
Destination filename [running-config]?
Router#sh run
519 bytes copied in 5.376 secs (97 bytes/sec)
Current configuration : 526 bytes
!
version 12.3
enable secret 5 $1$np61$k3BwEp1SRYu/itZtsv5Aj.
//
这时候密码仍然不知道,只能删掉了
Router(config)#no enable secret
//
删掉密码
Router#copy running-config startup-config
//
再
COPY
回去。
Destination filename [startup-config]?
Building configuration...
[OK]
Router(config)#config-register 0x2102
//
再把寄存器值改回来
Router#reload
//
重启就
OK
了
实验总结:密码恢复原理是寄存器值
2142
不加载配置文件,然后想办法改寄存器值。