思科IOS誤刪除如何恢復(fù)
思科擁有豐富的行業(yè)經(jīng)驗、先進(jìn)的技術(shù),路由器功能也在世界遙遙領(lǐng)先,那么你知道思科IOS誤刪除如何恢復(fù)嗎?下面是學(xué)習(xí)啦小編整理的一些關(guān)于思科IOS誤刪除如何恢復(fù)的相關(guān)資料,供你參考。
思科IOS誤刪除恢復(fù)的方法1:TFTP
近來發(fā)現(xiàn)許多網(wǎng)友因升級錯誤的IOS而丟失端口,現(xiàn)轉(zhuǎn)貼以下文章,幫助大家在ROMMON下恢復(fù)IOS:
在ROMMON狀態(tài)下,恢復(fù)2600和3600系列路由器的IOS
不小心把IOS刪掉或者升級IOS失敗,重起后進(jìn)入ROMMON(ROMMON狀態(tài)是ROM MONITOR的縮寫)狀態(tài),是比較常見的事,對一個新手而言,前者的可能要大些。兩者都可能使路由器進(jìn)入ROMMON狀態(tài),不能進(jìn)行正常的路由轉(zhuǎn)發(fā)功能和軟件配置,在這種模式下,原IOS中的大部分命令都無法使用。那怎么辦呢?根據(jù)Cisco網(wǎng)站的資料,我翻譯整理了兩種常用的方法:1.使用TFTP恢復(fù)IOS;2.使用Xmodem恢復(fù)IOS.不同的路由器的命令有些不一樣,這里以2600和3600系列路由為例,但是思路應(yīng)該是差不多的,下面分開講一下這兩種方法:
在進(jìn)行恢復(fù)之前,可以先看一下路由器的Flash里文件,用命令:dir flash:;注意命令中flash后面跟冒號(:),執(zhí)行命令后會顯示flash現(xiàn)存的IOS大小和文件名,如下面:
1. rommon 1 》 dir flash:
File size Checksum File name
2179331 bytes (0x214103)
0x7b95 c1600-nsy-mz_112-15a_p
如果File name和Filesize的兩項都是符合你的要求的,正確無誤,那么你就不必要進(jìn)行升級。這樣也許是你的config-register的設(shè)置有問題,正常的一般config-register應(yīng)該是0x2102的。注意0x2102中的最后一位值2, 最后一位值在2到F都是正常的。注意config-register的值控制著路由器的啟動!如果最后一位數(shù)值不是在這個范圍內(nèi),可以使用confreg 命令來改變它的值。關(guān)于config-register的16bit的每bit的含意,可以看一下cisco的技術(shù)資料,這里就不多說了。如果File name和File size的兩項有一項是錯的,那就進(jìn)行下面的升級步驟:
一、 使用TFTP恢復(fù)IOS
使用交叉的網(wǎng)線連接你的路由器以太口和裝有TFTP Server軟件的PC機(jī),在PC機(jī)上啟動TFTPServer軟件,并把新的IOS文件放在TFTP server所在目錄的根目錄下,如:你的TFTP Server軟件在機(jī)器裝的是Cisco TFTP Server目錄,那么就把新的IOS文件放在Cisco TFTP Server目錄下就可以了。用控制線將調(diào)試機(jī)器與路由器連接起來。
接下來的事就是在路由器進(jìn)行操作了,在路由器上首先要設(shè)置一下ROMMON狀態(tài)的環(huán)境變量,注意所有的環(huán)境變量都是大小寫敏感的,一定要注意了!往往出錯就是因為這個原因。具體下面設(shè)置如下:
打開機(jī)器的超級終端工具,連接上ROUTER,此時窗口中出現(xiàn)
的命令行提示符為: ROMMON 1 》 (其中"1"代表命令行的行數(shù))。在提示符后輸入命令:
ROMMON 1 》IP_ADDRESS= ROUTER的IP地址(要和TFTP軟件所在的機(jī)器在同一網(wǎng)段內(nèi))
ROMMON 2 》IP_SUBNET_MASK= ROUTER的子網(wǎng)掩碼
ROMMON 3 》DEFAUT_GATEWAY= 默認(rèn)網(wǎng)關(guān)地址 (可以沒有,也可以是TFTP服務(wù)器)
ROMMON 4 》TFTP_SERVER= TFTP 服務(wù)器IP地址
ROMMON 5 》TFTP_FILE= IOS文件名(只給出文件名,不需要路徑)
ROMMON 6 》tftpdnld 回車
注意:前面的幾條命令必須使用大寫,而最后的tftpdnld則要用小寫。設(shè)置完后要用sync命令保存環(huán)境變量到NVRAM,用set命令進(jìn)行察看設(shè)置。
在tftpdnld命令執(zhí)行后,只要根據(jù)提示選擇,就可完成文件的傳輸。當(dāng)文件傳輸完后,將自動回到命令行下,輸入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 機(jī)至路由器時,必需使用路由器的第一個以太口,即Ethernt0(對2500系列等),Ethernet0/0(對2600系列等),其它系列略有差別,可根據(jù)使用手冊進(jìn)行確定。
②在使用連接電纜時,一定要用交叉線,因這種情況屬DTE與DCE之間的連接。
?、墼谶\行tftp server的PC 機(jī)上,一定要有相應(yīng)的路由器的IOS印象文件,可以通過多種渠道和多種方式獲得該文件。
?、躷ftp server的地址可以隨意定義,但必須與路由器定義的地址在同一網(wǎng)段上。
思科IOS誤刪除恢復(fù)的方法2:XMODEM
IOS丟失以后,所有的設(shè)備都會啟動最小啟動模式。
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鍵之前,開始定義串口速度(我的電腦---端口屬性----串口速度調(diào)為115200),然后再修改超級終端里設(shè)置速率為115200,記住,一定這么做!否則出現(xiàn)亂碼! 然后關(guān)閉這個超級終端,重新建立一個超級終端連接,(期間系統(tǒng)重新啟動)啟動后,出現(xiàn)
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 …
此時,在超級終端的菜單上的"傳送"---"發(fā)送文件"----選擇IOS鏡像文件所在地以及選擇使用"xmodem"協(xié)議,點擊"發(fā)送"即可
然后等待10-20分鐘左右就把3-6M的IOS灌進(jìn)去了! 需要主意的是,這是科學(xué)估算時間和實際的時間相差很遠(yuǎn),實際如果10幾M的話要3個多小時。希望大家預(yù)備好咖啡和甜品準(zhǔn)備漫長的等待,本人深有體會,呵呵!
(修改回計算機(jī)串口與超級終端、路由器confreg下的xmodem等9600的傳輸速率)
(videre注:實際用的時候,我發(fā)現(xiàn)這個命令總是改不成功,后來發(fā)現(xiàn)在line con 0下面有了一個speed 115200,所以即使改register成功,啟動以后router又執(zhí)行speed 115200,還是不行,所以如果有這個問題,記得把這個語句no掉)
Router》en 進(jìn)入新IOS的特權(quán)模式
Router#reload 重啟系統(tǒng)
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,改回用標(biāo)準(zhǔn)速率速率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 》
此時手工改回計算機(jī)串口與超級終端2者傳輸速率為9600
然后敲入
rommon 2 》reset
( 最好關(guān)電源)
然后關(guān)閉這個超級終端,重新建立一個超級終端連接,一切就OK了
通過Xmodem升級2610的IOS實例
如果你不小心使用了命令erase flash 那么發(fā)生什么就可想而知了。因此,建議在你拿到路由器等網(wǎng)絡(luò)設(shè)備時最好先將它的IOS等操作系統(tǒng)備份出來,以備萬一!
本篇主要介紹通過Xmodem上傳IOS的過程(以2610為例,不過這個方法用在其他設(shè)備上沒什么太大區(qū)別)
準(zhǔn)備工作,只要有Cisco原配的線纜就可以(注:Xmodem與實際的modem沒有任何聯(lián)系 只是一個傳輸協(xié)議 數(shù)據(jù)是通過終端的串口和路由器的Console口灌進(jìn)去的)
在沒有IOS的情況下 系統(tǒng)只能進(jìn)入Rommon狀態(tài),在這個狀態(tài)下只能見到如下命令:
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 ? …
然后在超級終端的傳送欄目=》 選擇發(fā)送選項 =》 再選擇Xmodem 并指明IOS所在的路徑即開始上傳IOS,等待時間很長,視IOS的大小和傳輸速度。對于初次做IOS上傳,建議不要去修改什么傳輸速率。傳完以后 對整個系統(tǒng)初始化 界面如下:
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 ? …
然后在超級終端的傳送欄目=》 選擇發(fā)送選項 =》 再選擇Xmodem 并指明IOS所在的路徑即開始上傳IOS,等待時間很長,視IOS的大小和傳輸速度。對于初次做IOS上傳,建議不要去修改什么傳輸速率。傳完以后 對整個系統(tǒng)初始化 界面如下:
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 ? …
然后在超級終端的傳送欄目=》 選擇發(fā)送選項 =》 再選擇Xmodem 并指明IOS所在的路徑即開始上傳IOS,等待時間很長,視IOS的大小和傳輸速度。對于初次做IOS上傳,建議不要去修改什么傳輸速率。傳完以后 對整個系統(tǒng)初始化 界面如下:
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誤刪除如何恢復(fù)"的人還看了: