IOS文件的备份,升级,密码恢复,
一:密码恢复。
第一步:拔掉交换机的电源,按住MODE键不放,再插上电源,等待交换机上所有的接口颜色,有褐色变成绿色之后再松手。
 sw1#ÿ
C3500XL Boot Loader (C3500-HBOOT-M) Version 12.0(5.3)WC(1), MAINTENANCE INTERIM SOFTWARE
Compiled Mon 30-Apr-01 07:51 by devgoyal
 starting...
Base ethernet MAC Address: 00:07:eb:c1:9f:40
Xmodem file system is available.
 
The system has been interrupted prior to initializing the
flash filesystem.  The following commands will initialize
the flash filesystem, and finish loading the operating
system software:
 
    flash_init
    load_helper
    boot
 
第二步:进行密码恢复。
switch: flash_init  //初始化FLASH文件系统
Initializing Flash...
Switch:load_helper //
加载帮助文件,加载命令,之后加载可以使用
Switch:rename flash:/config.text flash:/config.old //重命名flash下的config.text,更改config.XXX,思科建议改成config.old。重名之后,交换机再次重启就不会加载原来的配置文件,config.text,这样就没有了密码
switch:boot //重启系统
第三步:查看FLASN,把现在的.old该为.text.
Switch#show flash
Directory of flash:/
  2  -rwx     1811552   Mar 01 1993 00:15:50  3500c.bin
  3  -rwx         676   Mar 01 1993 00:06:16  vlan.dat
  4  -rwx        1199   Mar 01 1993 00:24:59  config.old
3612672 bytes total (1797120 bytes free)
Switch#rename flash:/config.old flash:/config.text 
再把config.old改成config.text
Destination filename [config.text]?
Switch#
Switch#
第四步:查看文件是否改为.text.
Switch#show flash  // 查看文件修改正确否。
Directory of flash:/
  2  -rwx     1811552   Mar 01 1993 00:15:50  3500c.bin
  3  -rwx         676   Mar 01 1993 00:06:16  vlan.dat
  4  -rwx        1199   Mar 01 1993 00:24:59  config.text
3612672 bytes total (1797120 bytes free)
第五步:把文件从startup-config拷贝到running-config,并且删除原来密码。
Switch#copy startup-config running-config//  把原来的配置文件从startup-config拷贝到running-config
Destination filename [running-config]?
Switch(config)#no enable password//
删除enable密码。
        
Switch(config)#no enable secret/
删除secret密码。/
第六步:再把存文件到startup-config
Switch#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
二:IOS的文件备份。
第一步:查看交换机上FLASH的文件名,并记录下来。
sw1>en
sw1#sh flash
Directory of flash:/
  2  -rwx     1811552   Mar 01 1993 00:14:06  cisco.bin
  4  drwx       10176   Mar 01 1993 00:08:09  html
  5  -rwx        1174   Mar 01 1993 00:23:21  config.text
3612672 bytes total (514048 bytes free)
第二步:进入VLAN1配置一个IP地址,这个IP地址作为交换机的管理地址也作为直接与电脑相连的接口地址
sw1#config t
Enter configuration commands, one per line.  End with CNTL/Z.
sw1(config)#int vlan 1
sw1(config-if)#ip add 10.0.0.2 255.255.255.0//
sw1(config-if)#no shut
sw1(config-if)#end
第三步:在电脑上网卡配置的IP地址必须和你在VLAN1上配置的iP地址在同一个网段下,掩码也必须相同使用ping命令测试交换机和电脑能否相互ping通。
sw1#ping 10.0.0.1   //PING 电脑的IP地址。
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
!!!!!//PING
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/208/1007 ms
第四步:打开电脑上的TFTP文件,查看TFTP的地址是否与电脑上的IP一致,开始备份文件。
sw1#copy flash tftp//复制FLASH下的IOS到电脑上的TFTP的文件上
Source filename [cisco.bin]?
Address or name of remote host []? 10.0.0.1
Destination filename [cisco.bin]? 123.bin
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1811552 bytes copied in 39.938 secs (46450 bytes/sec)//备份成功。
 
三:IOS的文件升级。
sw1#copy tftp flash//复制电脑上的TFTP文件到FLASH下的IOS文件。
Address or name of remote host []? 10.0.0.1
Source filename []? 123.bin
Destination filename [123.bin]? cisco.bin
%Warning:There is a file already existing with this name
Do you want to over write? [confirm]
Accessing tftp://10.0.0.1/123.bin...
Loading 123.bin from 10.0.0.1 (via VLAN1): !.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 1811552 bytes]
 
1811552 bytes copied in 96.482 secs (18870 bytes/sec)//升级成功。
sw1#