今天要做的測試是模擬cisco路由器的IOS文件丟失,如何恢復路由器的IOS文件
實驗環境:
cisco2611路由器,PC機裝上TFTP軟件搭建TFTP服務器。
在刪除路由器IOS文件之前,要把路由器的IOS文件先備份到TFTP服務器上。
1、首先刪除路由器上的flash文件
Router#erase flash:
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
ee ...erasedee
Erase of flash: complete
Router#dir
Directory of flash:/
No files in directory
16252928 bytes total (16252928 bytes free)
Router#dir nv
Router#dir nvram:
Directory of nvram:/
27 -rw- 508 <no date> startup-config
28 ---- 5 <no date> private-config
1 -rw- 0 <no date> ifIndex-table
29688 bytes total (28099 bytes free)
2、IOS文件刪除完成後reload重啓一下路由器。
Router#reload
Proceed with reload? [confirm]
00:02:35: %SYS-5-RELOAD: Reload requested
System Bootstrap, Version 12.2(7r) [cmong 7r], RELEASE SOFTWARE (fc1)
Copyright (c) 2002 by cisco Systems, Inc.
C2600 platform with 32768 Kbytes of main memory
device does not contain a valid magic number
boot: cannot open "flash:"
boot: cannot determine first file name on device "flash:"
System Bootstrap, Version 12.2(7r) [cmong 7r], RELEASE SOFTWARE (fc1)
Copyright (c) 2002 by cisco Systems, Inc.
C2600 platform with 32768 Kbytes of main memory
3、到這裏,可以看到,路由器啓動過程被中斷了,因爲找不到IOS文件。
device does not contain a valid magic number
boot: cannot open "flash:"
4、現在,該是我們大顯身手的時候了,按Ctrl+Break進入rommon模式,
輸入set查看路由器的配置情況。
rommon 1 > set
PS1=rommon ! >
BSI=0
RET_2_RTS=
5、緊接着要做的就是配置路由器的IP地址,子網掩碼,網關,TFTP服務器地址,
以及TFTP文件名,這五項是必須要輸入的,當然了,還有幾項是選擇輸入的,
這裏不多講了。
rommon 2 > IP_ADDRESS=192.168.3.1
rommon 3 > IP_SUBNET_NETMASK=255.255.255.0
rommon 4 > DEFAULT_GATEWAY=192.168.3.254
rommon 5 > TFTP_SERVER=192.168.3.10
rommon 6 > TFTP_FILE=c2600-i-mz.122-8.T10.bin
6、做完這些配置之後,可以再次輸入set命令來查看一下剛剛配置的是否有錯誤。
7、下一步,就要輸入tftpdnld命令來下載IOS文件了。
rommon 7 > tftpdnld
IP_ADDRESS: 192.168.3.1
IP_SUBNET_MASK: 255.255.255.0
DEFAULT_GATEWAY: 192.168.3.254
TFTP_SERVER: 192.168.3.10
TFTP_FILE: c2600-i-mz.122-8.T10.bin
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
文件正在下載中,請稍後,呵呵......
Receiving c2600-i-mz.122-8.T10.bin from 192.168.3.10 !!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
File reception completed.
Copying file c2600-i-mz.122-8.T10.bin to flash.
Erasing flash at 0x60fc0000
program flash location 0x60590000
8、到現在爲止,IOS文件已經從TFTP服務器上下載完成了。reset重啓路由器。
rommon 8 > reset
System Bootstrap, Version 12.2(7r) [cmong 7r], RELEASE SOFTWARE (fc1)
Copyright (c) 2002 by cisco Systems, Inc.
C2600 platform with 32768 Kbytes of main memory
program load complete, entry point: 0x80008000, size: 0x5942dc
Self decompressing the p_w_picpath : #################################################
############################################## [OK]
此時,路由器已經可以正常啓動了!
以下省略n行部分路由器啓動過程,
當路由器啓動完成後,進入特權模式,查詢ios文件是否導入到路由器中
Router#dir
Directory of flash:/
1 -rw- 5850064 <no date> c2600-i-mz.122-8.T10.bin
16777216 bytes total (10927088 bytes free)
OK,困難排除了,路由器可以正常工作了。
本文出自 “linux on the way” 博客,請務必保留此出處http://linuxtro.blog.51cto.com/1239505/324165