路由器 IOS 昇級方法總結
在介紹CISCO路由器IOS昇級方法前,有必要對Cisco路由器的儲存於器的相關知識作以簡單介紹。路由器與電腦相似,它也有記憶體和作業系統。在Cisco路 由器中,其作業系統叫做互連網作業系統(Internetwork Operating System),常簡稱為IOS。路由器的儲存於器主要有:
ROM:唯讀儲存於器包含路由器正在使用的IOS的一份副本;
RAM:IOS將隨機訪問儲存於器分成共享和主存。主要用來儲存於執行中的路由器組態和與路由傳輸協定有關的IOS資料結構;
FLASH (FlashRom):用來儲存於IOS軟體映像文件,FlashRom是可以擦除記憶體,它能夠用IOS的新版本覆寫,IOS昇級主要是FlashRom中的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文件存在問題不可用;
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 Enter鍵
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 Enter鍵
注意:在按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] Enter鍵
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路由器上實際操作捕獲或抓圖,所配位址只是特例,大家可根據實際需要予以修改。最後建議:大家在作正常路由器系統昇級時,為防止不正確操作等引起的昇級失敗,請先把路由器原有的系統制作備份下來。