---
title: "cisco ios 升级方法和TFTP的用法"
author: "eseries"
date: "2009-08-14T10:21:55Z"
tags: []
slug: "cisco-ios-tftp"
draft: false
lastmod: "2009-08-14T10:21:55Z"
id: 447374
url: "https://eseries.iteye.com/blog/447374"
---

升级方法：  
现总结归纳出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）&gt;，在这种情形下，对路由器的IOS进行升级，也比较简单。首先进入特权模式下，即

QUOTE：Router（boot）&gt;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&gt;，在这种情形下，对路由器的IOS进行升级，情况要稍微复杂一点。在rommon 1&gt;状态下，可键？请求帮助。（1为命令行序号，每执行1条命令自动加1）

QUOTE：rommon 1 &gt; ？

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 &gt;在rommon 1&gt;状态下有两种升级IOS方法。

（一）、通过Xmodem命令（注：Xmodem与实际的modem没有任何联系 只是一个传输协议 数据是通过终端的串口和路由器的Console口灌进去的）升级IOS，具体步骤如下：

1、用Cisco原配的线缆连接路由器的console口与PC机的COM1，使用PC机的超级终端软件访问路由器，这时不需要对PC和路由器配置任何地址。

2、在这个模式下，输入Xmodem命令，即：

QUOTE：rommon 2 &gt; 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 …… （此时在超级终端的传送栏目=&gt; 选择发送文件选项 =&gt; 再选择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](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](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

 

TFTP的用法

首先是下载个TFTP软件，这是前提，有了软件，运行好，做一定简单设置后便可，我这主要讲在路由里的具体操作！

第一步  
进入路由器，设置一端口的IP地址，让他于TFTP服务器的ip在同一网段内！

第二步  
Router#copy tftp startup-config  
Address or name of remote host \[]? 192.168.1.181  
Source filename \[]? cisco207-confg  
Destination filename \[startup-config]?

Router#copy flash tftp  
Source filename \[]? c2500-js-l.122-13.bin  
Address or name of remote host \[]? 192.168.1.185  
Destination filename \[c2500-js-l.122-13.bin]?

基本的格式是  
copy 源位置 目标位置

记住格式，其他的操作都类似！

当你在flash中注入更新的IOS的后，show flash后会出现2个ios，这时候，怎么

让设备运行刚注入的新的IOS呢，这是就必需更改开机调用的顺序。

Router#show flash

System flash directory:  
file   length   Name/status  
   1   222222   c2500-js-l.122-13.bin  
   2   333333   c2600-js-l.122-13.bin  
8192K bytes of processor board System flash (Read/Write)

这时候如何设置呢？

Router#conf t  
Enter configuration commands, one per line.   End with CNTL/Z.  
Router(config)#boot sy  
Router(config)#boot system fa  
Router(config)#boot system fl  
Router(config)#boot system flash c2600-js-l.122-13.bin  
Router(config)#exit