前不久,朋友在對一臺帶語音模快的CISCO2610進行IOS升級時,由於路由器的內存(flash)為8M,IOS軟件為7M多,升級後路由器無法正常啟動。啟動後到rommon 1 >狀態,請求幫助。由於本人長期從事計算機網絡管理工作,在對CISCO路由器的長期日常維護和管理實踐中積累了一定的經驗。現總結歸納出CISCO路由器IOS映像升級的幾種方法,供廣大網絡愛好者或同仁參考。在介紹CISCO路由器IOS升級方法前,有必要對Cisco路由器的存儲器的相關知識作以簡單介紹。路由器與計算機相似,它也有內存和操作系統。在Cisco路由器中,其操作系統叫做互連網操作系統(Internetwork Operating System),常簡稱為IOS.路由器的存儲器主要有:
ROM:只讀存儲器包含路由器正在使用的IOS的一份副本;
RAM:IOS將隨機訪問存儲器分成共享和主存。主要用來存儲運行中的路由器配置和與路由協議有關的IOS數據結構;
FLASH (閃存):用來存儲IOS軟件映像文件,閃存是可以擦除內存,它能夠用IOS的新版本覆寫,IOS升級主要是閃存中的IOS映像文件進行更換。
NVRAM:非易失性隨機訪問存儲器,用來存儲系統的配置文件。
IOS升級方法一
在對能夠正常啟動的CISCO路由器的IOS進行升級時,比較簡單。具體步驟如下:
1、尋找一種TFTP服務器軟件(有CISCO公司的TFTPServer或3COM公司的3Cserver等,在升級較大IOS映象文件時,建議用3Cserver),安裝在一臺計算機上,將要升級的IOS映象文件拷貝到相關的目錄中(例:D:\),並運行TFTP服務器軟件,通過菜單設置Root目錄為拷貝IOS映象文件所在目錄(如D:\)。假設該計算機的IP地址為10.32.10.1;
2、連接路由器的console口與PC機的COM1,使用PC的超級終端軟件訪問路由器,將路由器的地址設為10.32.10.32(與計算機的IP地址同網段即可)。建議在進行IOS升級前將原有IOS文件備份下來,防止待升級的IOS文件存在問題不可用;
QUOTE:Router# dir flash:     (查看目前IOS映象文件名,也可用Router#Show version)
Directory of flash:/
1  -rw-     5998292                C2600-I-MZ.122-11.BIN
8388608 bytes total (2390252 bytes free)
Router#copy flash tftp            (備份IOS文件)
Source filename []?c2600-i-mz.122-11.bin
Address or name of remote host []? 10.32.10.1    (TFTP服務器地址)
Destination filename [c2600-i-mz.122-11.bin]?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5998292 bytes copied in 324.071 secs (18509 bytes/sec)
Router# 3、對路由器進行IOS升級;
QUOTE:Router#copy tftp flash
Address or name of remote host []? 10.32.10.1       (TFTP服務器地址)
Source filename []? c2600-i-mz.122-11.bin         (需升級的新IOS映象文件名)
Destination filename [c2600-i-mz.122-11.bin]?
Do you want to over write? [confirm]
Accessing tftp://10.32.10.1/c2600-i-mz.122-11.bin……
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device…… eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ……erasedee
Erase of flash: complete
Loading c2600-i-mz.122-11.bin from 10.32.10.1 (via Ethernet0/0): !!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 5998292 bytes]
Verifying checksum……  OK (0xA0C0)
5998292 bytes copied in 318.282 secs (18846 bytes/sec)
Router# IOS升級方法二
由於升級失敗後或者路由器的config-register寄存器值為0x2101時,開啟路由器時、或者在開啟(某些型號)Cisco路由器的電源開關後30秒內按下Ctrl+break鍵,中斷路由器的正常啟動,路由器都會進入rom監視模式,即Router(boot)>,在這種情形下,對路由器的IOS進行升級,也比較簡單。首先進入特權模式下,即
QUOTE:Router(boot)>en
Router(boot)#其他升級步驟同方法一,即:執行copy tftp flash命令,對IOS進行升級。升級完成後,不要忘了修改config-register寄存器值為0x2102(恢復正常值)。
QUOTE:Router(boot)# t
Router(boot)( config)# config-register 0x2102
Router(boot)( config)#exit
Router(boot)#wr
Router(boot)#reload重啟即可。

IOS升級方法三
由於不小心使用了命令erase flash或升級失敗後或在開啟(某些型號)Cisco路由器的電源開關後30秒內按下Ctrl+break鍵,中斷路由器的正常啟動,路由器都會進入rom監視模式,即 rommon 1>,在這種情形下,對路由器的IOS進行升級,情況要稍微復雜一點。在rommon 1>狀態下,可鍵?請求幫助。(1為命令行序號,每執行1條命令自動加1)
QUOTE:rommon 1 > ?
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 loaded image
cookie              display contents of cookie PROM in hex
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 system return
tftpdnld            tftp image download
unalias             unset an alias
unset               unset a monitor variable
xmodem              x/ymodem image download
rommon 2 >在rommon 1>狀態下有兩種升級IOS方法。
(一)、通過Xmodem命令(註:Xmodem與實際的modem沒有任何聯系 只是一個傳輸協議 數據是通過終端的串口和路由器的Console口灌進去的)升級IOS,具體步驟如下:
1、用Cisco原配的線纜連接路由器的console口與PC機的COM1,使用PC機的超級終端軟件訪問路由器,這時不需要對PC和路由器配置任何地址。
2、在這個模式下,輸入Xmodem命令,即:
QUOTE:rommon 2 > xmodem -c c2600-i-mz.122-11.bin
(-c是帶校驗,c2600-i-mz.122-11.bin為存放在PC機上的IOS映像文件)
WARNING: All existing data in bootflash will be lost!
Invoke this application only for disaster recovery.
Do you wish to continue? y/n  [n]:  y Ready to receive file c2600-i-mz.122-11.bin ……      (此時在超級終端的傳送欄目=> 選擇發送文件選項 => 再選擇Xmodem 並指明IOS映像文件所在的路徑,按發送即開始上傳IOS,等待時間很長,視IOS的大小和傳輸速度。)
QUOTE:Erasing flash at 0x607c0000
program flash location 0x605b0000
Download Complete!
傳完以後,對整個系統初始化 顯示如下:
QUOTE:program load complete, entry point: 0x80008000, size: 0x5b85e0
Self decompressing the image :
[OK]
Smart Init is disabled. IOMEM set to: 10
Using iomem percentage: 10
Restricted Rights Legend
Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.
cisco Systems, Inc.
170 West Tasman Drive
San Jose, California 95134-1706
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-I-M), Version 12.2(11)T9,  RELEASE SOFTWARE (fc1)
TAC Support: http://www.cisco.com/tac
Copyright (c) 1986-2003 by cisco Systems, Inc.
Compiled Mon 23-Jun-03 15:42 by cmong
Image text-base: 0x8000809C, data-base: 0x80A68B48
cisco 2610 (MPC860) processor (revision 0x203) with 22528K/2048K bytes of memory
Processor board ID JAD03483395 (1128032249)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
1 Ethernet/IEEE 802.3 interface(s)
2 Serial(sync/async) network interface(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read/Write)
Press RETURN to get started!
*Mar  1 00:00:05.652: %PA-2-UNDEFPA: Undefined Port Adaptor type 100 in bay 1
*Mar  1 00:00:07.996: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar  1 00:00:07.996: %LINK-3-UPDOWN: Interface Serial0/0, changed state to down
*Mar  1 00:00:07.996: %LINK-3-UPDOWN: Interface Serial0/1, changed state to down
*Mar  1 00:00:09.142: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
*Mar  1 00:00:09.142: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
*Mar  1 00:00:09.142: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to down
*Mar  1 00:00:09.458: %SYS-5-CONFIG_I: Configured from memory by console
*Mar  1 00:00:11.245: %LINK-5-CHANGED: Interface Serial0/1, changed state to administratively down
*Mar  1 00:00:12.275: %SYS-5-RESTART: System restarted ——Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-I-M), Version 12.2(11)T9,  RELEASE SOFTWARE (fc1)
TAC Support: http://www.cisco.com/tac
Copyright (c) 1986-2003 by cisco Systems, Inc.
Compiled Mon 23-Jun-03 15:42 by cmong
*Mar  1 00:00:12.279: %SNMP-5-COLDSTART: SNMP agent on host NE16 is undergoing a cold start
Router>采用這種方法時,由於使用console口來傳送,速率為9600bps,需要時間較長。因此可修改console口速率利用xmodem命令實現快速升級IOS.具體方法如下:
QUOTE: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,用最大的11520
速率的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,記住,一定要這麽做,否則會出現亂碼! 然後關閉這個超級終端,重新建立一個超級終端連接,重新啟動系統後,出現
QUOTE:rommon 1> 提示符然後,輸入
QUOTE:rommon 1> xmodem -r
Do not start the sending program yet……
Invoke this application only for disaster recovery.
Do you wish to continue? y/n [n]: y (選擇 yes)
Ready to receive file ……
此時,在超級終端的菜單上的“傳送”——“發送文件”——選擇IOS映像文件所在地以及選擇使用“xmodem”協議,點擊“發送”即可。等待10-20分鐘左右就可升級完3-6M的IOS文件!待升級完成後,請記住修改回計算機串口與超級終端、路由器confreg下的xmodem等傳輸速率為9600bps.
方法如下:
QUOTE:Router>en 進入新IOS的特權模式
Router#reload 重啟系統
Proceed with reload? [confirm] 回車
00:01:04: %SYS-5-RELOAD: Reload requested
System Bootstrap, Version 11.3(2)XA4, RELEASE SOFTWARE (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 main memory
PC = 0xfff0a530, Vector = 0x500, SP = 0x80004684
monitor: command "boot" aborted due to user interrupt
30秒內按ctrl+break鍵
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 nn 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 new config to take effect
rommon 2 >此時手工改回計算機串口與超級終端2者傳輸速率為9600
然後敲入
QUOTE:rommon 2 >reset最好關掉電源後,重新啟動。利用xmodem命令實現路由器IOS升級速度較慢,往往等上很長時間,為了快速升級,可以采用下列方法。

(二)通過tftpdnld命令升級IOS,具體步驟如下:
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 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-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),進入正常引導狀態,即:
Router>筆者在Cisco2500、2600、7200等系列路由器上均實際操作過,以上為在Cisco2610路由器上實際操作捕獲或截屏,所配地址只是特例,大家可根據實際需要予以修改。最後建議:大家在作正常路由器系統升級時,為防止不正確操作等引起的升級失敗,請先把路由器原有的系統備份下來。
arrow
arrow
    文章標籤
    Cisco 網絡 運維
    全站熱搜

    愛在屋簷下 發表在 痞客邦 留言(0) 人氣()