路由器IOS更新方法總結
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更新;
Router#copy tftp flash
Address or name of remote host []? 10.32.10.1 (TFTP伺服器位址)
Source filename []? c2600-i-mz.122-11.bin (需更新的新IOS映象檔案名)
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)
IOS更新方法二
由于更新失敗後或者路由器的config-register寄存器值為0x2101時,開啟路由器時、或者在開啟(某些型号)Cisco路由器的電源開關後30秒内按下Ctrl+break鍵,中斷路由器的正常啟動,路由器都會進入rom監視模式,即Router(boot)>,在這種情形下,對路由器的IOS進行更新,也比較簡單。首先進入特權模式下,即
Router(boot)>en
Router(boot)#
其他更新步驟同方法一,即:執行copy tftp flash指令,對IOS進行更新。更新完成後,不要忘了修改config-register寄存器值為0x2102(恢複正常值)。
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)
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指令,即:
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的大小和傳輸速度。)
Erasing flash at 0x607c0000
program flash location 0x605b0000
Download Complete!
傳完以後,對整個系統初始化 顯示如下:
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)
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
*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。具體方法如下:
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)
console baud: 115200
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,記住,一定要這麼做,否則會出現亂碼! 然後關閉這個超級終端,重建立立一個超級終端連接配接,重新啟動系統後,出現
rommon 1> 提示符
然後,輸入
rommon 1> xmodem -r
Do not start the sending program yet...
Do you wish to continue? y/n [n]: y (選擇 yes)
Ready to receive file ...
此時,在超級終端的菜單上的“傳送”---“發送檔案”----選擇IOS映像檔案所在地以及選擇使用“xmodem”協定,點選“發送”即可。等待10-20分鐘左右就可更新完3-6M的IOS檔案!待更新完成後,請記住修改回計算機序列槽與超級終端、路由器confreg下的xmodem等傳輸速率為9600bps。
方法如下:
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”指令)
enable "use nn IP bcast address"? y/n [n]: n (選擇 no)
4 = 19200, 5 = 38400, 6 = 57600, 7 = 115200 [7]: 0 (選擇 0,改回用标準速率速率9600的xmodem傳輸)
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
然後敲入
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 指令檢視配置參數
rommon 2 > set
PS1=rommon ! >
BOOT=
BSI=0
RET_2_RTS=
?=0
4、在 rommon 狀态下輸入:(注意大小寫)
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
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
rommon 11 >tftpdnld
執行tftpdnld指令進行ios更新,有時可能會報錯或指令不執行,這時隻要用sync指令儲存配置後,重新啟動路由器(最好關掉電源再開機)後,再執行tftpdnld指令就可以了。
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.
rommon 13 >
在rommon 13 >提示符下鍵入reset,或重新啟動路由器(power-cycle),進入正常引導狀态,即:
Router>
交換機如何更新IOS:
1、用控制線連接配接交換機console口與計算機序列槽1,用帶有xmodem功能的終端軟體連接配接(win2000 and xp的超級終端就帶這功能)。
2、設定連接配接方式為序列槽1(如果連接配接的是其他序列槽就選擇其他序列槽),速率9600,無校驗,無流控,停止位1。或者點選預設設定也可以。
3、連接配接以後計算機回車出現交換機無ios的界面,一般的提示符是:switch: (如果不是請繼續下面步驟4-5)
4、拔掉交換機後的電源線
5、按住交換機面闆左側的mode鍵(一般交換機就着一個鍵),插入交換機後邊的電源插頭給交換機加電。等到看到交換機面闆上所有以太口訓示燈都亮綠燈(隻有1口不亮)和交換機的幾個系統訓示燈隻有最上面一個常亮時,放開mode鍵。
6、放開mode鍵後,在超級終端提示符switch:後輸入:
switch:flash_init
會出現如下提示:
Initializing Flash...
flashfs[0]: 1 files, 1 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 3612672
flashfs[0]: Bytes used: 1536
flashfs[0]: Bytes available: 3611136
flashfs[0]: flashfs fsck took 3 seconds.
...done Initializing Flash.
Boot Sector Filesystem (bs installed, fsid: 3
Parameter Block Filesystem (pb installed, fsid: 4
7、switch:load_helper
輸入後無提示
8:輸入拷貝指令:(格式:copy xmodem: flash:imagename.bin)注:在flash前要加一個空格
switch:copy xmodem: flash:image_filename.bin
我的實際指令是:
switch: copy xmodem: flash:c3550-i5q3l2-mz.121-20.EA1a.bin
出現如下提示:
Begin the Xmodem or Xmodem-1K transfer now...
9、系統提示不斷出現C這個字母就可以開始傳檔案了
10、點選超級終端菜單:傳送---發送檔案,在協定選項中選擇Xmodem或者Xmodem-1K協定,然後選擇ios的影像檔案(*.bin),開始傳送。
11、因為不能改速率,是以傳送得很慢,我的大概傳送了100分鐘左右,請耐心等待。
12、傳送完畢後提示:
File "xmodem:" successfully copied to "flash: c3550-i5q3l2-mz.121-20.EA1a.bin "
switch:
13、在提示符下輸入
switch:boot
啟用新的ios系統,此時我的原配置還都在!
14、拔掉電源後重新加電完成恢複工作。
from:http://www.mimicall.com/dispbbs.asp?boardID=7&ID=248&page=1
本文轉自 wqmsl 51CTO部落格,原文連結:http://blog.51cto.com/wqmsl/309278,如需轉載請自行聯系原作者