学习啦>学习电脑>网络知识>路由器>路由器设置>cisco思科>

思科IOS误删除如何恢复

权威分享

  思科拥有丰富的行业经验、先进的技术,路由器功能也在世界遥遥领先,那么你知道思科IOS误删除如何恢复吗?下面是学习啦小编整理的一些关于思科IOS误删除如何恢复的相关资料,供你参考。

  思科IOS误删除恢复的方法1:TFTP

  近来发现许多网友因升级错误的IOS而丢失端口,现转贴以下文章,帮助大家在ROMMON下恢复IOS:

  在ROMMON状态下,恢复2600和3600系列路由器的IOS

  不小心把IOS删掉或者升级IOS失败,重起后进入ROMMON(ROMMON状态是ROM MONITOR的缩写)状态,是比较常见的事,对一个新手而言,前者的可能要大些。两者都可能使路由器进入ROMMON状态,不能进行正常的路由转发功能和软件配置,在这种模式下,原IOS中的大部分命令都无法使用。那怎么办呢?根据Cisco网站的资料,我翻译整理了两种常用的方法:1.使用TFTP恢复IOS;2.使用Xmodem恢复IOS.不同的路由器的命令有些不一样,这里以2600和3600系列路由为例,但是思路应该是差不多的,下面分开讲一下这两种方法:

  在进行恢复之前,可以先看一下路由器的Flash里文件,用命令:dir flash:;注意命令中flash后面跟冒号(:),执行命令后会显示flash现存的IOS大小和文件名,如下面:

  1. rommon 1 》 dir flash:

  File size Checksum File name

  2179331 bytes (0x214103)

  0x7b95 c1600-nsy-mz_112-15a_p

  如果File name和Filesize的两项都是符合你的要求的,正确无误,那么你就不必要进行升级。这样也许是你的config-register的设置有问题,正常的一般config-register应该是0x2102的。注意0x2102中的最后一位值2, 最后一位值在2到F都是正常的。注意config-register的值控制着路由器的启动!如果最后一位数值不是在这个范围内,可以使用confreg 命令来改变它的值。关于config-register的16bit的每bit的含意,可以看一下cisco的技术资料,这里就不多说了。如果File name和File size的两项有一项是错的,那就进行下面的升级步骤:

  一、 使用TFTP恢复IOS

  使用交叉的网线连接你的路由器以太口和装有TFTP Server软件的PC机,在PC机上启动TFTPServer软件,并把新的IOS文件放在TFTP server所在目录的根目录下,如:你的TFTP Server软件在机器装的是Cisco TFTP Server目录,那么就把新的IOS文件放在Cisco TFTP Server目录下就可以了。用控制线将调试机器与路由器连接起来。

  接下来的事就是在路由器进行操作了,在路由器上首先要设置一下ROMMON状态的环境变量,注意所有的环境变量都是大小写敏感的,一定要注意了!往往出错就是因为这个原因。具体下面设置如下:

  打开机器的超级终端工具,连接上ROUTER,此时窗口中出现

  的命令行提示符为: ROMMON 1 》 (其中"1"代表命令行的行数)。在提示符后输入命令:

  ROMMON 1 》IP_ADDRESS= ROUTER的IP地址(要和TFTP软件所在的机器在同一网段内)

  ROMMON 2 》IP_SUBNET_MASK= ROUTER的子网掩码

  ROMMON 3 》DEFAUT_GATEWAY= 默认网关地址 (可以没有,也可以是TFTP服务器)

  ROMMON 4 》TFTP_SERVER= TFTP 服务器IP地址

  ROMMON 5 》TFTP_FILE= IOS文件名(只给出文件名,不需要路径)

  ROMMON 6 》tftpdnld 回车

  注意:前面的几条命令必须使用大写,而最后的tftpdnld则要用小写。设置完后要用sync命令保存环境变量到NVRAM,用set命令进行察看设置。

  在tftpdnld命令执行后,只要根据提示选择,就可完成文件的传输。当文件传输完后,将自动回到命令行下,输入reset重启ROUTER,重启后就又回到了熟悉的IOS模式下 甚至连以前配置的信息都不会丢失。

  下面是具体的例子:

  Example

  rommon 16 》 IP_ADDRESS=172.16.0.1

  rommon 17 》 IP_SUBNET_MASK=255.255.255.0

  rommon 18 》 DEFAULT_GATEWAY=172.16.0.2

  rommon 19 》 TFTP_SERVER=172.16.0.2

  rommon 20 》 TFTP_FILE=c2600-is-mz.113-2.0.3.Q

  rommon 21 》 tftpdnld

  IP_ADDRESS: 172.16.0.1

  IP_SUBNET_MASK: 255.255.255.0

  DEFAULT_GATEWAY: 172.16.0.2

  TFTP_SERVER: 172.16.0.2

  TFTP_FILE: c2600-is-mz.113-2.0.3.Q

  Invoke this command for disaster recoveryonly.

  WARNING: all existing data in all partitions on flash will be lost!

  Do you wish to continue? y/n: [n]: y

  Receiving c2600-is-mz.113-2.0.3.Q from172.16.0.2 !!!!!.!!!!!!!!!!!!!!!!!!!.!!

  File reception completed.

  Copying file c2600-is-mz.113-2.0.3.Q toflash.

  Erasing flash at 0x607c0000

  program flash location 0x60440000

  rommon 22 》

  注意的几个问题

  ①在连接运行tftp server的PC 机至路由器时,必需使用路由器的第一个以太口,即Ethernt0(对2500系列等),Ethernet0/0(对2600系列等),其它系列略有差别,可根据使用手册进行确定。

  ②在使用连接电缆时,一定要用交叉线,因这种情况属DTE与DCE之间的连接。

  ③在运行tftp server的PC 机上,一定要有相应的路由器的IOS印象文件,可以通过多种渠道和多种方式获得该文件。

  ④tftp server的地址可以随意定义,但必须与路由器定义的地址在同一网段上。

  思科IOS误删除恢复的方法2:XMODEM

  IOS丢失以后,所有的设备都会启动最小启动模式。

  rommon 1 》 confreg 回车

  Configuration 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 newconfig to take effect

  rommon 2 》 reset 回车

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

  rommon 1》提示符

  然后,输入

  rommon 1》 xmodem -r

  Do not start the sending program yet…

  Invoke this application only for disasterrecovery.

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

  Ready to receive file …

  此时,在超级终端的菜单上的"传送"---"发送文件"----选择IOS镜像文件所在地以及选择使用"xmodem"协议,点击"发送"即可

  然后等待10-20分钟左右就把3-6M的IOS灌进去了! 需要主意的是,这是科学估算时间和实际的时间相差很远,实际如果10几M的话要3个多小时。希望大家预备好咖啡和甜品准备漫长的等待,本人深有体会,呵呵!

  (修改回计算机串口与超级终端、路由器confreg下的xmodem等9600的传输速率)

  (videre注:实际用的时候,我发现这个命令总是改不成功,后来发现在line con 0下面有了一个speed 115200,所以即使改register成功,启动以后router又执行speed 115200,还是不行,所以如果有这个问题,记得把这个语句no掉)

  Router》en 进入新IOS的特权模式

  Router#reload 重启系统

  Proceed with reload? [confirm] 回车

  00:01:04: %SYS-5-RELOAD: Reload requested

  System Bootstrap, Version 11.3(2)XA4, RELEASESOFTWARE (fc1)

  Copyright (c) 1999 by Cisco Systems, Inc.

  TAC:Home:SW:IOS:Specials for info

  PC = 0xfff0a530, Vector = 0x500, SP = 0x680127b0

  C2600 platform with 24576 Kbytes of mainmemory

  PC = 0xfff0a530, Vector = 0x500, SP = 0x80004684

  monitor: command "boot" aborted due to user interrupt

  rommon 1 》 confreg ( 输入"confreg"命令)

  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]: 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 [7]: 0 (选择 0,改回用标准速率速率9600的xmodem传输)

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

  Configuration 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]: n

  You must reset or power cycle for newconfig to take effect

  rommon 2 》

  此时手工改回计算机串口与超级终端2者传输速率为9600

  然后敲入

  rommon 2 》reset

  ( 最好关电源)

  然后关闭这个超级终端,重新建立一个超级终端连接,一切就OK了

  通过Xmodem升级2610的IOS实例

  如果你不小心使用了命令erase flash 那么发生什么就可想而知了。因此,建议在你拿到路由器等网络设备时最好先将它的IOS等操作系统备份出来,以备万一!

  本篇主要介绍通过Xmodem上传IOS的过程(以2610为例,不过这个方法用在其他设备上没什么太大区别)

  准备工作,只要有Cisco原配的线缆就可以(注:Xmodem与实际的modem没有任何联系 只是一个传输协议 数据是通过终端的串口和路由器的Console口灌进去的)

  在没有IOS的情况下 系统只能进入Rommon状态,在这个状态下只能见到如下命令:

  rommon 8 》 ?

  alias set and display aliases command

  boot boot up an external process

  break set/show/clear the breakpoint

  confreg configuration register utility

  cont continue executing a downloaded image

  context display the context of a loadedimage

  cookie display contents of cookie PROM inhex

  dev list the device table

  dir list files in file system

  dis display instruction stream

  dnld serial download a program module

  frame print out a selected stack frame

  help monitor builtin command help

  history monitor command history

  meminfo main memory information

  repeat repeat a monitor command

  reset system reset

  set display the monitor variables

  stack produce a stack trace

  sync write monitor environment to NVRAM

  sysret print out info from last systemreturn

  tftpdnld tftp image download

  unalias unset an alias

  unset unset a monitor variable

  xmodem x/ymodem image download

  在这个模式下,输入Xmodem

  rommon 9 》 xmodem

  会提示如下警告:

  WARNING: All existing data in bootflash will be lost!

  Invoke this application only for disasterrecovery.

  Do you wish to continue? y/n [n]: y

  Ready to receive file ? …

  然后在超级终端的传送栏目=》 选择发送选项 =》 再选择Xmodem 并指明IOS所在的路径即开始上传IOS,等待时间很长,视IOS的大小和传输速度。对于初次做IOS上传,建议不要去修改什么传输速率。传完以后 对整个系统初始化 界面如下:

  Erasing flash at 0x603c0000

  program flash location 0x602f0000

  Download Complete!

  program load complete, entry point: 0x80008000, size:0x2f0074

  Self decompressing the image :

  Restricted Rights Legend

  Use, duplication, or disclosure by theGovernment is

  subject to restrictions as set forth insubparagraph

  (c) of theCommercial Computer Software - Restricted

  Rights clause at FAR sec. 52.227-19 andsubparagraph

  (c) (1)(ii) of the Rights in Technical Dataand Computer

  Software clause at DFARS sec. 252.227-7013.

  Cisco Systems, Inc.

  170 West Tasman Drive

  San Jose, California 95134-1706

  Cisco Internetwork Operating SystemSoftware

  IOS (tm) C2600 Software (C2600-I-M), Version 11.3(6)T, RELEASE SOFTWARE (fc1)

  Copyright (c) 1986-1998 by Cisco Systems, Inc.

  Compiled Tue 06-Oct-98 18:42 by ccai

  Image text-base: 0x80008084,data-base: 0x80554578

  alias set and display aliases command

  boot boot up an external process

  break set/show/clear the breakpoint

  confreg configuration register utility

  cont continue executing a downloaded image

  context display the context of a loadedimage

  cookie display contents of cookie PROM inhex

  dev list the device table

  dir list files in file system

  dis display instruction stream

  dnld serial download a program module

  frame print out a selected stack frame

  help monitor builtin command help

  history monitor command history

  meminfo main memory information

  repeat repeat a monitor command

  reset system reset

  set display the monitor variables

  stack produce a stack trace

  sync write monitor environment to NVRAM

  sysret print out info from last systemreturn

  tftpdnld tftp image download

  unalias unset an alias

  unset unset a monitor variable

  xmodem x/ymodem image download

  在这个模式下,输入Xmodem

  rommon 9 》 xmodem

  会提示如下警告:

  WARNING: All existing data in bootflash will be lost!

  Invoke this application only for disasterrecovery.

  Do you wish to continue? y/n [n]: y

  Ready to receive file ? …

  然后在超级终端的传送栏目=》 选择发送选项 =》 再选择Xmodem 并指明IOS所在的路径即开始上传IOS,等待时间很长,视IOS的大小和传输速度。对于初次做IOS上传,建议不要去修改什么传输速率。传完以后 对整个系统初始化 界面如下:

  Erasing flash at 0x603c0000

  program flash location 0x602f0000

  Download Complete!

  program load complete, entry point: 0x80008000, size:0x2f0074

  Self decompressing the image :

  Restricted Rights Legend

  Use, duplication, or disclosure by theGovernment is

  subject to restrictions as set forth insubparagraph

  (c) of theCommercial Computer Software - Restricted

  Rights clause at FAR sec. 52.227-19 andsubparagraph

  (c) (1)(ii) of the Rights in Technical Dataand Computer

  Software clause at DFARS sec. 252.227-7013.

  Cisco Systems, Inc.

  170 West Tasman Drive

  San Jose, California 95134-1706

  Cisco Internetwork Operating SystemSoftware

  IOS (tm) C2600 Software (C2600-I-M), Version 11.3(6)T, RELEASE SOFTWARE (fc1)

  Copyright (c) 1986-1998 by Cisco Systems, Inc.

  Compiled Tue 06-Oct-98 18:42 by ccai

  Image text-base: 0x80008084,data-base: 0x80554578

  alias set and display aliases command

  boot boot up an external process

  break set/show/clear the breakpoint

  confreg configuration register utility

  cont continue executing a downloaded image

  context display the context of a loadedimage

  cookie display contents of cookie PROM inhex

  dev list the device table

  dir list files in file system

  dis display instruction stream

  dnld serial download a program module

  frame print out a selected stack frame

  help monitor builtin command help

  history monitor command history

  meminfo main memory information

  repeat repeat a monitor command

  reset system reset

  set display the monitor variables

  stack produce a stack trace

  sync write monitor environment to NVRAM

  sysret print out info from last systemreturn

  tftpdnld tftp image download

  unalias unset an alias

  unset unset a monitor variable

  xmodem x/ymodem image download

  在这个模式下,输入Xmodem

  rommon 9 》 xmodem

  会提示如下警告:

  WARNING: All existing data in bootflash will be lost!

  Invoke this application only for disasterrecovery.

  Do you wish to continue? y/n [n]: y

  Ready to receive file ? …

  然后在超级终端的传送栏目=》 选择发送选项 =》 再选择Xmodem 并指明IOS所在的路径即开始上传IOS,等待时间很长,视IOS的大小和传输速度。对于初次做IOS上传,建议不要去修改什么传输速率。传完以后 对整个系统初始化 界面如下:

  Erasing flash at 0x603c0000

  program flash location 0x602f0000

  Download Complete!

  program load complete, entry point: 0x80008000, size:0x2f0074

  Self decompressing the image :

  Restricted Rights Legend

  Use, duplication, or disclosure by theGovernment is

  subject to restrictions as set forth insubparagraph

  (c) of theCommercial Computer Software - Restricted

  Rights clause at FAR sec. 52.227-19 andsubparagraph

  (c) (1)(ii) of the Rights in Technical Dataand Computer

  Software clause at DFARS sec. 252.227-7013.

  Cisco Systems, Inc.

  170 West Tasman Drive

  San Jose, California 95134-1706

  Cisco Internetwork Operating SystemSoftware

  IOS (tm) C2600 Software (C2600-I-M), Version 11.3(6)T, RELEASE SOFTWARE (fc1)

  Copyright (c) 1986-1998 by Cisco Systems, Inc.

  Compiled Tue 06-Oct-98 18:42 by ccai

  Image text-base: 0x80008084,data-base: 0x80554578

  Cisco 2610 (MPC860) processor (revision 0x202) with 12288K/4096K bytes ofmemory

  .

  Processor board ID JAB0233005Z (3677578902)

  M860 processor: part number 0, mask 32

  Bridging software.

  X.25 software, Version 3.0.0.

  1 Ethernet/IEEE 802.3 interface(s)

  1 Serial network interface(s)

  32K bytes of non-volatile configurationmemory.

  4096K bytes of processor board System flash(Read/Write)

  Press RETURN to get started!

  00:00:06: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

  00:00:06: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up

  00:00:06: %SYS-5-CONFIG_I: Configured from memory byconsole

  00:00:06: %SYS-5-RESTART: System restarted --

  Cisco Internetwork Operating SystemSoftware

  IOS (tm) C2600 Software (C2600-I-M), Version 11.3(6)T, RELEASE SOFTWARE (fc1)

  Copyright (c) 1986-1998 by Cisco Systems, Inc.

  Compiled Tue 06-Oct-98 18:42 by ccai

  00:00:07: %LINEPROTO-5-UPDOWN: Line protocol on

  WL_bank_2610_2》Interface Ethernet0/0, changed state to up

  00:00:07: %LINEPROTO-5-UPDOWN: Line protocol onInterface Serial0/0, changed sta

  te to up

  00:00:07: %LINEPROTO-5-UPDOWN: Line protocol onInterface Loopback0, changed sta

  看过文章“思科IOS误删除如何恢复"的人还看了:

  1.利用脚本配置思科路由器教程

  2.思科配置常见问题及其解决方法

  3.思科路由器怎么阻断局域网病毒传播

  4.当代防火墙技术到底有什么问题

  5.如何设置思科路由器密码

  6.思科IOS防止遭受IP地址欺骗攻击的三种办法

  7.cisco ip phone怎么设置

  8.连接常见错误和解决方法

  9.cisco保存设置

    554599