实验要求:
在交换机密码忘记的情况下,知道如何恢复密码。
实验目的:
1.知道交换机配置文件和VLAN保存在那里。
2.知道怎么进入MIini IOS模式。
3.掌握如何破解IOS密码。
实验拓扑:

实验步骤:
1.查看
查看配置Flash文件:
Switch# sh flash:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Directory of flash:/
3 -rwx 3081999 Mar 01 1993 00:30:15 +00:<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />00 c2950-i6q4l2-mz.121-22.EA1.bin
IOS名字
7741440 bytes total (4658176 bytes free)
2.设密码
配置Enable密码保存后查看Flash变化。证明配置文件是保存在Flash的running-config里面。
Switch(config)#enable password cisco
Switch#copy running-config startup-config
Destination filename [running-config]?
745 bytes copied in 1.196 secs (623 bytes/sec)
Switch#sh flash:
Directory of flash:/
2 -rwx 745 Mar 01 1993 00:17:23 +00:00 running-config
3 -rwx 772 Mar 01 1993 00:28:14 +00:00 config.text
4 -rwx 3081999 Mar 01 1993 00:30:15 +00:00 c2950-i6q4l2-mz.121-22.EA1.bin
3.设VLAN
配置VLAN后查看Flash变化。证明VLAN是保存在Flash的vlan.dat里面。重启交换机。
Switch#vlan database
Switch(vlan)#vl 2
VLAN 2 added:
Name: VLAN0002
Switch(vlan)#
Switch(vlan)#vl 3
VLAN 3 added:
Name: VLAN0003
Switch(vlan)#vl 4
VLAN 4 added:
Name: VLAN0004
Switch(vlan)#
Switch(vlan)#exi
APPLY completed.
Exiting....
Switch#
sh flash:
Directory of flash:/
2 -rwx 772 Mar 01 1993 00:28:14 +00:00 config.text
3 -rwx 3081999 Mar 01 1993 00:30:15 +00:00 c2950-i6q4l2-mz.121-22.EA1.bin
4 -rwx 5 Mar 01 1993 00:28:14 +00:00 private-config.text
5 -rwx 676 Mar 01 1993 00:28:42 +00:00 vlan.dat
Switch#reload
Switch>enable
Password: 这时需要密码,如果忘记了怎办。只能想办法破解。
4.进入Mini IOS模式
把Flash里面的config.text改掉就是了。
switch: flash_init 先初始化
Initializing Flash...
flashfs[0]: 4 files, 1 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 7741440
flashfs[0]: Bytes used: 3085824
flashfs[0]: Bytes available: 4655616
flashfs[0]: flashfs fsck took 6 seconds.
...done initializing flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4
switch: dir flash: 查看Flash
Directory of flash:/
2 -rwx 772 <date> config.text
3 -rwx 3081999 <date> c2950-i6q4l2-mz.121-22.EA1.bin
4 -rwx 5 <date> private-config.text
5 -rwx 676 <date> vlan.dat
4655616 bytes available (3085824 bytes used)
switch: rename flash:config.text flash:cisco 将config.text改成cisco
switch: dir flash: 查看Flash
Directory of flash:/
2 -rwx 772 <date> cisco
3 -rwx 3081999 <date> c2950-i6q4l2-mz.121-22.EA1.bin
4 -rwx 5 <date> private-config.text
5 -rwx 676 <date> vlan.dat
4655616 bytes available (3085824 bytes used)
switch: reset 重启
Are you sure you want to reset the system (y/n)?y
Switch>en
Switch#
Switch#sh startup-config
startup-config is not present
Switch#rename flash:cisco flash:config.text 再将 cisco改成 config.text
Destination filename [config.text]?
Switch#
Switch#sh star 原来的配置就可以查看到了。
Switch#sh startup-config
Using 772 out of 32768 bytes
!
version 12.1
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Switch
!
enable password cisco
!
ip subnet-zero
Switch(config)#no enable password 删掉密码或改密码就完成了
实验总结:
配置文件是保存在Flash的config.text里,只要把config.text改了就不再调用配置文件,也就不需要密码了。
转载于:https://blog.51cto.com/76673629/144502