实验步骤:
1.
查看
查看配置
Flash
文件:
Switch# sh flash:
Directory of flash:/
3 -rwx 3081999 Mar 01 1993 00:30:15 +00: 00 c 2950-i6q 4l 2-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 c 2950-i6q 4l 2-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 c 2950-i6q 4l 2-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-i6q 4l 2-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-i6q 4l 2-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
改了就不再调用配置文件,也就不需要密码了。