当前位置:   article > 正文

IOS恢复

IOS恢复

1、实验目的

通过本实验可以掌握:

  • copy方式恢复IOS的步骤。
  • TFTPDNLD方式恢复IOS的步骤。
  • Xmodem方式恢复IOS的步骤。

2、实验拓扑

路由器IOS恢复的实验拓扑如下图所示。

3、实验步骤

        如果工作中不慎误删除路由器IOS,或者升级了错误版本的IOS,导致路由器不能正常启动,动,可以通过COPY方式恢复IOS,也也可以通过TFTPDNLD恢复IOS,还可以用Xmodem方式通过Console端口恢复IOS,然而由于Console端口的速率很慢,除非万不得已,否则很少有人采用。需要注意的是,如果误删除了1OS,请不要将路由器关机或者重启,这样可以直接使用COPY方式从TFTP服务器恢复IOS,这比起上述其他2种方法都简单。注意,也可以通过命令tftp-server flash0:c2900-universalk9-mz.SPA.157-3.M.bin把路由器配置成TFTP服务器,这样就不需要单独的TFTP服务器了。

3.1、通过copy方式恢复IOS(TFTP服务器)

(1)查看IOS文件系统
  1. R1#show file systems //查看IOS文件系统
  2. File Systems:
  3. Size(b) Free(b) Type Flags Prefixes
  4. * 255744000 221896413 disk rw flash0: flash:#
  5. 262136 255005 nvram rw nvram:
  6. R1#dir //查看Flash存储上的文件
  7. Directory of flash0:/
  8. 3 -rw- 33591768 <no date> c2900-universalk9-mz.SPA.151-4.M4.bin
  9. 2 -rw- 28282 <no date> sigdef-category.xml
  10. 1 -rw- 227537 <no date> sigdef-default.xml
  11. 255744000 bytes total (221896413 bytes free)

        以上输出列出了Flash、NVRAM和 USBFlash的总的可用空间和空闲空间的大小、文件系统的类型及其权限和文件系统的前缀名称。在命令输出的Flags字段中显示权限包括只读(ro)、只写(wo)和读写(rw)。值得注意的是usbflash0:只有在插入Flash后才会显示。Cisco交交换机和路由器上支持许多基本UNIX命令,如用于更改文件系统或目录的cd命令、用于显示文件系统目录的dir命令和用于显示当前工作目录的pwd命令等。

(2)删除IOS文件,模拟误删除
  1. R1#delete flash:c2900-universalk9-mz.SPA.151-4.M4.bin //删除C2900的IOS文件
  2. Delete filename [c2900-universalk9-mz.SPA.151-4.M4.bin]?
  3. Delete flash:/c2900-universalk9-mz.SPA.151-4.M4.bin? [confirm]
  4. R1#dir
  5. Directory of flash0:/ //确认文件已被删除
  6. 2 -rw- 28282 <no date> sigdef-category.xml
  7. 1 -rw- 227537 <no date> sigdef-default.xml
  8. 255744000 bytes total (255488181 bytes free)
(3)从TFTP服务器192.168.1.100上复制 IOS

(4)路由器R1上的操作
  1. R1#copy tftp: flash:
  2. Address or name of remote host []? 192.168.1.100 //tftp服务器的IP地址
  3. Source filename []? c2900-universalk9-mz.SPA.155-3.M4a.bin //粘贴文件名
  4. Destination filename [c2900-universalk9-mz.SPA.155-3.M4a.bin]? //回车确认
  5. Accessing tftp://192.168.1.100/c2900-universalk9-mz.SPA.155-3.M4a.bin....
  6. Loading c2900-universalk9-mz.SPA.155-3.M4a.bin from 192.168.1.100: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  7. [OK - 33591768 bytes]
  8. 33591768 bytes copied in 3.296 secs (1070084 bytes/sec)
  9. R1#dir //查看Flash上的文件
  10. Directory of flash0:/
  11. 4 -rw- 33591768 <no date> c2900-universalk9-mz.SPA.155-3.M4a.bin
  12. 2 -rw- 28282 <no date> sigdef-category.xml
  13. 1 -rw- 227537 <no date> sigdef-default.xml
  14. 255744000 bytes total (221896413 bytes free)
  15. R1#write //保存配置文件
  16. Building configuration...
  17. [OK]
  18. R1#reload //重启路由器

  1. R1#show version //重启后查看IOS版本信息
  2. Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.5(3)M4a, RELEASE SOFTWARE (fc1)

3.2、通过copy方式恢复IOS(FTP服务器)

(1)设置FTP(192.168.1.100)服务器

(2)路由器上的配置
  1. R1#dir
  2. Directory of flash0:/
  3. 4 -rw- 33591768 <no date> c2900-universalk9-mz.SPA.155-3.M4a.bin
  4. 2 -rw- 28282 <no date> sigdef-category.xml
  5. 1 -rw- 227537 <no date> sigdef-default.xml
  6. 255744000 bytes total (221896413 bytes free)
  7. R1#delete flash:c2900-universalk9-mz.SPA.155-3.M4a.bin //拷贝的文件名
  8. Delete filename [c2900-universalk9-mz.SPA.155-3.M4a.bin]?
  9. Delete flash:/c2900-universalk9-mz.SPA.155-3.M4a.bin? [confirm]
  10. R1#conf t
  11. R1(config)#ip ftp username cisco //配置登录ftp服务器的账号
  12. R1(config)#ip ftp password cisco //配置登录ftp服务器的密码
  13. R1#copy ftp: flash: //登录ftp服务器拷贝文件
  14. Address or name of remote host []? 192.168.1.100 //设置ftp服务器的IP地址
  15. Source filename []? c2900-universalk9-mz.SPA.155-3.M4a.bin //拷贝的文件名
  16. Destination filename [c2900-universalk9-mz.SPA.155-3.M4a.bin]?
  17. Accessing ftp://192.168.1.100/c2900-universalk9-mz.SPA.155-3.M4a.bin...

确认下载成功后即可继续使用。

3.3、通过TFTPDNLD恢复IOS

        IOS丢失或者毁坏后,掉电或者重启,路由器加载IOS文件失败后,开机将进入 rommon(ROM监控)模式。恢复IOS之前请确保服务器上启动TFTP服务,并将IOS放置到正确的目录中。路由器配置步骤如下所述。

(1)删除IOS模拟故障
  1. R1#delete flash:c2900-universalk9-mz.SPA.155-3.M4a.bin
  2. Delete filename [c2900-universalk9-mz.SPA.155-3.M4a.bin]?
  3. Delete flash:/c2900-universalk9-mz.SPA.155-3.M4a.bin? [confirm]
  4. %Error deleting flash:/c2900-universalk9-mz.SPA.155-3.M4a.bin (No such file or directory)
  5. R1#reload
  6. System configuration has been modified. Save? [yes/no]:yes
  7. Building configuration...
  8. [OK]
  9. Proceed with reload? [confirm]
(2)配置TFTPDNLD恢复IOS
  1. rommon 1 > IP_ADDRESS=192.168.1.254
  2. rommon 2 > IP_SUBNET_MASK=255.255.255.0
  3. rommon 3 > DEFAULT_GATEWAY=192.168.1.100
  4. rommon 4 > TFTP_SERVER=192.168.1.100
  5. rommon 5 > TFTP_FILE=c2900-universalk9-mz.SPA.155-3.M4a.bin
  6. rommon 6 > tftpdnld
  7. IP_ADDRESS: 192.168.1.254
  8. IP_SUBNET_MASK: 255.255.255.0
  9. DEFAULT_GATEWAY: 192.168.1.100
  10. TFTP_SERVER: 192.168.1.100
  11. TFTP_FILE: c2900-universalk9-mz.SPA.155-3.M4a.bin
  12. Invoke this command for disaster recovery only.
  13. WARNING: all existing data in all partitions on flash will be lost!
  14. Do you wish to continue? y/n: [n]: y
(3)成功拉取镜像后使用reset命令重启系统即可
rommon 9 > reset

3.4、通过Xmodem方式利用Console端口恢复IOS

        在 SecureCRT窗口中,选择【传输】下拉菜单,然后单击【发送XModem[N]..】,传输菜单如图12-8所示。打开如图12-9所示窗口,选择IOS文件,单击【发送】按钮发送文件。如图12-10所示开始传输IOS 文件。由于速度很慢,通常需要几个小时,请耐心等待,通信速率为9 600bps,传送完毕后执行boot命令启动路由器。

实验至此结束。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/509855
推荐阅读
相关标签
  

闽ICP备14008679号