Flash contains files. Are you sure you want to erase? [confirm] Copy 'c2500.31.bin' from server
as 'c2500.31.bin' into Flash WITH erase? [yes/no]y Erasing device...
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Loading c2500.31.bin from 192.168.1.99 (via
Ethernet0): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 15989548/16777216 bytes] Verifying checksum... OK (0x6725) Flash copy took 0:09:14 [hh:mm:ss] Router(boot)#conf t
Router(boot)(config)#config-register 0x2142 【技术要点】升级完记得要把配置寄存器值修改回来。
【说明】针对2600系列之后的路由器可以不用修改配置寄存器值,其flash的默认属性就是read/write。
【技术要点】在升级ios时要注意:
1) 确保flash的属性是read/write,如果不是要对其进行修改; 2) 确保flash有足够的空间;
【思考6】能否将路由器3640系列的IOS升级到2600系列的路由器?为什么?
【技术要点】IOS的升级除了可以使用TFTP方式升级外,还可以使用如FTP等其他方式升级,不管采用FTP还是TFTP或者其他方式升级,都要建立并确保服务器与路由器之间的连通性。
【技术要点】思科TFTP服务器存在一定的缺陷,在升级较大IOS文件时容易出错,更建议使用3COM公司的”3CDaemon”。
【技术要点】升级有两种方式,分为本地升级和对远程设备的升级。 【技术要点】升级只能针对同一硬件平台的设备升级,比如不能将3600平台的IOS升级到2500的平台。
【技术要点】如果工作中不慎误删IOS,千万不要将路由器关机,可以直接使用”copy tftp flash”命令从TFTP服务器恢复IOS。
【思考7】如果因为路由器硬件,软件bug或者人为恶意或者误删除IOS导致了灾难性的后果,设备根本无法正常引导,该怎么办?
【思考8】如果升级IOS的过程中严重丢包,那么升级完后的IOS还可以正常使用吗?
7. IOS的灾难恢复
(1) 不小心删除了flash
rr14#delete flash:c2501-3.bin Delete filename [c2501-3.bin]?
Delete flash:c2501-3.bin? [confirm]^[ Delete of flash:c2501-3.bin aborted! rr14# 【说明】删除flash后,千万不要重启,直接将路由器桥接到我们的PC,将路由器的IOS导入到路由器就可以了,步骤跟备份IOS的步骤类似,如果重启了路由器,只能进行IOS的灾难恢复。
(2) IOS灾难恢复
【说明】有时因为路由器硬件,软件bug或者人为原因误删了IOS文件,导致路由器根本无法正常引导,我们一般会使用接下来介绍的两种IOS灾难恢复的方式:
【说明】设备无法正常引导的情况下会进入”rommon>”模式。
【警告】不要随意删除中心机房的路由器的IOS文件!否则后果自负!!!
1) Xmodem方式恢复
在终端界面按照如下步骤进行: 3600 / 2600 in rommon
1- rommon > b ---------- to boot first image in flash mem
2- rommon > dir flash: ---------- list the files on the device 3- rommon > meminfo ---------- to see memory information You are in rommon and
1- when \ 2- dir flash: reveals an invalid check sum.
3- So the last solution is to download an image using xmodem When in ROMMON mode, follow the procedure below Using the ROMMON confreg
utility.
rommon 2 > confreg //修改相关参数
do you wish to change the configuration? y/n [n]: y enable \
enable \ disable \ enable \ enable \
enable \
change console baud rate? y/n [n]: y //修改波特率
enter rate: 0 = 9600, 1 = 4800, 2 = 1200, 3 = 2400 4 = 19200, 5 = 38400, 6 = 57600, 7 = 115200 [7]: 7 change the boot characteristics? y/n [n]: y enter to boot: 0 = ROM Monitor
1 = the boot helper image 2-15 = boot system [0]: 0
Configuration Summary enabled are:
load rom after netboot fails console baud: 115200 boot: the ROM Monitor
do you wish to change the configuration? y/n [n]: n
You must reset or power cycle for new config to take effect rommom 2 > reset
The next step is to open a new hyperterminal with settings as follows,
Bits per second - 115200 Data bits - 8 Parity - None Stop bits - 1
Flow control - Hardware
After setting the hyperterminal you get a rommon prompt, and type the
xmodem command. Before typing an xmodem command there should be a software image
residing in your terminal or your local C drive.
rommon 2 > xmodem -c c3640-i-mz.121-7.bin //使用xmode向设备加载IOS文件
Do not start the sending program yet... File size Checksum File name
4936800 bytes (0x4b5460) 0x2dd7 c3640-i-mz.121-7.bin (bad checksum: 0x13eb)
WARNING: All existing data in flash will be lost! Invoke this application only for disaster recovery. Do you wish to continue? y/n [n]: y
Ready to receive file c3640-i-mz.121-7.bin ...
After the above message appears u have to download the file using
xmodem,
the procedure is as follows,
1) Go to Hyperterminal, click Transfer 2) Click on send file
3) click on browse -------- look for the file name in your local \
drive
4) Below filename field is Protocol ------- change it to xmodem 5) And then clik on send After some time the router will reload itself and will ask you \ return to get stated\ Router> en Router#conf t
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#conf t
Router(config)#config-register 0x2102 Router(config)#line con 0
Router(config-line)# speed 9600 --------- Change the speed of the
console port to 9600
//将波特率改回默认值9600
Then go to Hyperterminal and change baud rate to 9600 in your terminal.
Router(config-line)#ctrl z
Router #write mem //保存配置
Router #reload
【说明】使用Xmode方式是通过console线进行的升级方式,但使用console口方式升级速度很慢,很少有人采用,接下来介绍一种工作中更常用的方式。
2) TFTP广播升级方式恢复
准备工作,用网线将本机与要恢复IOS文件的路由器的以太网接口连在一起,将要恢复的IOS文件放在TFTP根目录下,然后打开TFTP服务器,打开丢失IOS文件的路由器,待路由器进入rommon模式后,进行如下操作: rommon 2 > IP_ADDRESS=192.168.1.88
rommon 3 > IP_SUBNET_MASK=255.255.255.0 rommon 4 > DEFAULT_GATEWAY=192.168.1.99 rommon 5 > TFTP_SERVER=192.168.1.99 rommon 6 > TFTP_FILE=C2600.bin //要恢复IOS,需要配置一些变量的值,即路由器的ip地址、掩码、网关、TFTP服务器的地址及要升级的IOS文件,注意变量名都是大写的。 rommon 8 > tftpdnld //开始从tftp 恢复IOS IP_ADDRESS: 192.168.1.88
IP_SUBNET_MASK: 255.255.255.0
DEFAULT_GATEWAY: 192.168.1.99 TFTP_SERVER: 192.168.1.99
Invoke this command for disaster recovery only.
WARNING: all existing data in all partitions on flash will be lost! Do you wish to continue? y/n: [n]: y //回答“y”开始从tftp 服务器上恢复IOS,根据IOS 的大小,通常需要十几分钟
Receiving C2600.bin from192.168.1.99 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (此处省略)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! File reception completed.
Copying file C2600.bin to flash. Erasing flash at 0x60fc0000
Program flash location 0x60f30000 rommon 9 > i //重启路由器
8.
路由器的密码恢复
(1) 步骤1:在路由器上配置密码并保存配置文件
room-five(config)#enable secret qwertyuioasdfghddssf1234 room-five(config)#exit
room-five#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] room-five#
【说明】故意配置一个自己也记不住的密码并保存,以供密码恢复使用 【思考9】回顾下路由器的启动顺序?
【思考10】比较running-config与startup-config的区别?
(2) 步骤2:路由器密码恢复
关闭路由器电源并重新开机,在开机的30秒内按住ctrl+break键中断路由器的启动过程,进入rommon>模式,如下:
System Bootstrap, Version 12.4(1r) [hqluong 1r], RELEASE SOFTWARE (fc1) Copyright (c) 2005 by cisco Systems, Inc.