cisco路由器IOS灾难恢复

参考:CISCO IOS升级方法

Fastest Way to Recover or Upgrade Cisco IOS using tftpdnld

如果IOS被损坏,例如升级IOS过程中断电等。

可以在ROM monitor commands模式下通过2种方法恢复:xmodem 或者 tftpdnld

1.xmodem

xmodem—Use this if the computer attached to your console has a terminal emulator that has xmodem capability.

第一步:

  先打开超级终端,进入rommon 模式(Ctrl+Break组合键),键入confreg, 如下:

  rommon 1 > confreg 回车

  onfiguration Summary

  enabled are:

  load rom after netboot fails

  console baud: 9600

  boot: image specified by the boot system commands or default to: cisco2-C2600

  ****显示

  do you wish to change the configuration? y/n [n]: y (选择 yes)

  enable "diagnostic mode"? y/n [n]: n (选择 no)  

  enable "use net in IP bcast address"? y/n [n]: n (选择 no)

  disable "load rom after netboot fails"y/n [n]: n (选择 no)

  enable "use all zero broadcast"? y/n [n]: n (选择 no)

  enable "break/abort has effect"? y/n [n]: n (选择 no)

  enable "ignore system config info"? y/n [n]: n (选择 no)

  change console baud rate y/n [n]: y (选择 yes)

  enter rate: 0 = 9600, 1= 4800, 2 = 1200, 3 = 2400 4 = 19200, 5 = 38400, 6 = 57600, 7 = 115200 [0]: 7 (选择 7,用最大的115200速率的xmodem传输)

  change the boot characteristics? y/n [n]: n (选择 no)

  Configuration Summary

  enabled are:

  load rom after netboot fails

  console baud: 115200

  boot: image specified by

  the boot system commands or default to: cisco2-C2600

  do you wish to change the configuration? y/n [n]: n (选择 no)

  You must reset or power cycle for new config to take effect

  rommon 2 > reset 回车

  注意:在此时键入 reset键,然后再修改超级终端里设置端,重新建立一个超级终端连接之前,开始定义串口速度(我的电脑速率为115200,记住,一定这么做,(期间系统重新启动)启动后,出--端口属性----串口速度调为115200 ,否则出现乱码!

  rommon 1> xmodem -cr

  Do not start the sending program yet.

  invoke this applicationonly for disaster recovery.

  Do you wish to continue? y/n [n]: y (选择 yes)  

  Ready to receive file

  此时,在超级终端的菜单上的“传送”---xmodem”协议,点击“发送”即可发送文件”----选择IOS镜像文件所在地以及选择使用“然后等待10-20分钟左右就把3-6M的IOS灌进去了

  !!!! 会自动引导IOS(c2600-i-mz.122-8.T10.bin),进入EN模式,show flash: ,会发现损坏的IOS版本被删除,其实只是做了一个1 5850064 c2600-i-mz.122-8.T10.bin(delected)的标志,在EN模式下,用

  squeeze flash:c2600-i-mz.122-8.T10.bin物理删除它。(#######¥¥¥¥¥记住一定不要重起)

  其实IOS没有倒入,是调用的配置文件。

  show flash:

  会发现IOS没有

  (#######¥¥¥¥¥记住一定不要重起)

  第二步:倒入IOS

  手动把E0/1用直连线插到交换机上,笔记本的网卡也用直连线也插到交换机上

  en

  show run

  conf t

  int fa0/1

  ip add 192.168.0.2 255.255.255.0

  no shu

  exit

  exit

  wr

  笔记本网卡设置成192.168.0.1 255.255.255.0

  在ROUTE上 ping 192.168.0.1

  打开TFTP,把IOS拷贝到TFTP目录下(c2600-i-mz.122-8.T10.bin)

  en

  copy tftp flash:c2600-i-mz.122-8.T10.bin

  完毕后

  show flash

  (!!!!!绝对不能重起)

  看到版本c2600-i-mz.122-8.T10.bin,后面没有delected

  倒入成功

  conf t

  config-register 0x2102

  boot system flash c2600-i-mz.122-8.T10.bin

  exit

  exit

  wr

  reload

  会引导到正常的操作模式下,成功

  第三步:

  改到9600,可要可不要

方法2:tftpdnld  tftpdnld—Use this if you have a TFTP server directly connected to the Ethernet 0 port.

1、用Cisco原配的线缆连接路由器的console口与PC机的COM1,使用PC机的超级终端软件访问路由器;用一根双绞线连接路由器的eth0/0口与PC机的网卡。

  2、将路由器的eth0/0口IP地址设为10.32.10.32;PC机的IP地址设为10.32.10.1.将要升级的IOS映象文件拷贝到相关的目录中,并运行TFTP服务器软件,通过菜单设置Root目录为拷贝IOS映象文件所在目录。
  3、通过set 命令查看配置参数
  QUOTE:rommon 2 > set
  PS1=rommon ! >
  BOOT=
  BSI=0
  RET_2_RTS=
  ?=0 4、在 rommon 状态下输入:(注意大小写)
  QUOTE:rommon 3 >IP_ADDRESS=10.32.10.1 (路由器的ip地址)
  rommon 4 >IP_SUBNET_MASK=255.255.255.0 (路由器的掩码)
  rommon 5 >DEFAULT_GATEWAY=10.32.10.32 (缺省网关,是pc机的ip地址)
  rommon 6 >TFTP_SERVER=10.32.10.32 (是pc机的ip地址)
  rommon 7 >TFTP_FILE=C2600-I-MZ.122-11.BIN (上传ios文件的名称)
  rommon 8>sync (保存参数配置)
  rommon 9 >set (查看)
  rommon 10 > set
  PS1=rommon ! >
  BOOT=
  IP_ADDRESS=10.32.10.1
  IP_SUBNET_MASK=255.255.255.0
  DEFAULT_GATEWAY=10.32.10.32
  TFTP_SERVER=10.32.10.32
  TFTP_FILE=C2600-I-MZ.122-11.BIN
  BSI=0
  RET_2_RTS=
  ?=0
  rommon 11 >tftpdnld执行tftpdnld命令进行ios升级,有时可能会报错或命令不执行,这时只要用sync命令保存配置后,重新启动路由器(最好关掉电源再开机)后,再执行tftpdnld命令就可以了。
  QUOTE:rommon 11 >tftpdnld(传送文件)出现提示选择y
  IP_ADDRESS: 10.32.10.1
  IP_SUBNET_MASK: 255.255.255.0
  DEFAULT_GATEWAY: 10.32.10.32
  TFTP_SERVER: 10.32.10.32
  TFTP_FILE: C2600-I-MZ.122-11.BIN
  Invoke this command for disaster recovery .ly.
  WARNING: all existing data in all partitions . flash will be lost!
  Do you wish to continue? y/n: [n]: y
  Receiving C2600-I-MZ.122-11.BIN from 10.32.10.32!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  …
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  File reception completed.
  Copying file C2600-I-MZ.122-11.BIN to flash.
  Erasing flash at 0x607c0000
  program flash location 0x605b0000
  rommon 13 >
  在rommon 13 >提示符下键入reset,或重新启动路由器(power-cycle),进入正常引导状态,


 

原文地址:https://www.cnblogs.com/jjkv3/p/1379887.html