本文档说明了如何在同一个路由器内以及不同路由器之间将系统镜像从一个设备复制到另一个设备。
本文档没有任何特定的要求。
本文档不限于特定的软件和硬件版本。本文档的示例中使用的平台为 Cisco 2500 系列路由器和 Cisco 3600 系列路由器。
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
下表提供了将系统镜像从一个设备复制到另一个设备(方法随平台的不同而不同) 的命令选项:
下面列表包括您从TFTP服务器复制镜像的不同位置。这些选项随平台的不同而有所差异。有关详细信息以及各个选项的详情,请参阅使用 URL 前缀。
Router#copy tftp ?
语法说明 | |
---|---|
bootflash: | 复制到 bootflash:文件系统 |
disk0: | 复制到 disk0:文件系统 |
disk1: | 复制到 disk1:文件系统 |
flash: | 复制到 flash:文件系统 |
flh: | 复制到 flh:文件系统 |
ftp: | 复制到 ftp:文件系统 |
lex: | 复制到 lex:文件系统 |
null: | 复制到 null:文件系统 |
nvram: | 复制到 nvram:文件系统 |
rcp: | 复制到 rcp:文件系统 |
running-config | 更新(合并到)当前系统配置 |
slot0: | 复制到 slot0:文件系统 |
slot1: | 复制到 slot1:文件系统 |
startup-config | 复制到启动配置 |
system: | 复制到 system:文件系统 |
tftp: | 复制到 tftp:文件系统 |
镜像复制最常用的三个命令为:
copy tftp flash
copy rcp flash
copy slot0:slot1:
下面的示例说明了在 Cisco 3600 系列路由器上将系统镜像从一个设备复制到另一个设备(例如,从一个插槽/磁盘复制到另一个插槽/磁盘)时应当遵守的程序。
详细示例
router#show slot0: !--- This command is used to view the contents of slot 0 -#- ED --type-- --crc--- -seek-- nlen -length- -----date/time------ name 1 .D unknown 5E8B84E6 209D8 11 2392 Jan 22 2000 00:22:42 flashconfig 2 .. image 5E7BAE19 B623C4 22 11802988 Jan 22 2000 00:23:18 rsp-jsv-mz.1 20-8.0.2.T router#show slot1: !--- This command is used to view the contents of slot 1 -#- ED --type-- --crc--- -seek-- nlen -length- -----date/time------ name 1 .. unknown 6A2B4BA7 6FA9E0 20 7186784 Jul 30 1999 15:05:19 rsp-jv-mz.11 1-26.CC1 2 .. config 631F0D8B 6FB1EC 6 1929 Oct 19 1999 06:15:49 config 3 .. config 631F0D8B 6FB9F8 7 1929 Oct 19 1999 06:16:03 config1
下面显示的 copy 命令用于将系统镜像文件从一个设备复制到另一个设备。在以下示例中,系统镜像被从 slot0 复制到 slot1。
router#copy slot0: slot1 Source filename []? rsp-jsv-mz.120-8.0.2.T !--- Enter the file name of the system image to be copied Destination filename [slot1]? Erase slot1: before copying? [confirm]Erasing the slot1 filesystem will remove all files! Continue? [confirm] Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erasedeeErase of slot1: complete Copy in progress...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCC ! --- Output Suppressed Verifying checksum... OK (0xE884)11802988 bytes copied in 346.312 secs (38481 bytes/sec)
以下是将 Cisco IOS 软件镜像从一个作为 TFTP 服务器的路由器中复制到另一个路由器中的步骤。该示例中的两个路由器都是 Cisco 2500 系列路由器。在本示例中,路由器 1 是 TFTP 服务器,路由器 2 是 Cisco IOS 软件镜像被复制到的路由器。
在开始之前,请使用 ping 命令验证 Router1 和 Router2 之间的连通性。
使用 show flash 命令检查 Router1 上的镜像的大小。
Router1#show flash System flash directory: File Length Name/status 1 15694836 /c2500-js-l.122-10b !--- Cisco IOS image file to be copied [15694900 bytes used, 1082316 available, 16777216 total] 16384K bytes of processor board System flash (Read ONLY)
使用 show flash 命令,检查路由器 2 上的镜像大小,以验证路由器 2 上是否有足够的可用空间,来复制系统镜像文件。
Router2#show flash System flash directory: File Length Name/status 1 11173264 c2500-jos56i-l.120-9.bin [11173328 bytes used, 5603888 available, 16777216 total] 16384K bytes of processor board System flash (Read ONLY)
注意:如果有足够的空间复制系统映像文件,则可以保留原始文件,并将新文件复制到额外的内存空间中。如果有足够可用空间,在这种情况下,闪存中现有文件被删除,同时下载新的文件。使用copy flash tftp命令,将现有系统镜像备份到TFTP服务器上是一个好习惯。
使用 configure terminal 命令将 Router1 配置为 TFTP 服务器。
Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#tftp-server ? bootflash: Allow URL file TFTP load requests disk0: Allow URL file TFTP load requests disk1: Allow URL file TFTP load requests flash: Allow URL file TFTP load requests flh: Allow URL file TFTP load requests lex: Allow URL file TFTP load requests null: Allow URL file TFTP load requests nvram: Allow URL file TFTP load requests slot0: Allow URL file TFTP load requests slot1: Allow URL file TFTP load requests system: Allow URL file TFTP load requests
注意:上文提供的 tftp-server 命令选项可能因平台不同而异。
Router1(config)#tftp-server flash:? flash:/c2500-js-l.122-10b !--- The Cisco IOS image file name. Router1(config)#tftp-server flash:/c2500-js-l.122-10b !--- This command configures the router as a TFTP server. Router1(config)#^Z
当配置 TFTP 服务器时,使用 copy tftp flash 命令,将指定的镜像从路由器 1 下载到路由器 2。
Router2#copy tftp flash **** NOTICE **** Flash load helper v1.0 This process will accept the copy options and then terminate the current system image to use the ROM based image for the copy. Routing functionality will not be available during that time. If you are logged in via telnet, this connection will terminate. Users with console access can see the results of the copy operation. ---- ******** ---- Proceed? [confirm] Address or name of remote host []? 10.10.10.1 !--- Enter the IP address of the TFTP Server Source filename []? /c2500-js-l.122-10b !--- This is the filename of the Cisco IOS image !--- that you want to copy from the TFTP server Destination filename [c2500-js-l.122-10b]? !--- Press 'Enter' Accessing tftp://10.10.10.1//c2500-js-l.122-10b... Erase flash: before copying? [confirm] 18:37:54: %SYS-5-RELOAD: Reload requested !--- The reload is platform-specific and is only for the !--- Run-from-flash systems.* ** System going down for Flash upgrade ** %SYS-4-CONFIG_NEWER: Configurations from version 12.2 may not be correctly understood. %FLH: /c2500-js-l.122-10b from 10.10.10.1 to flash ... System flash directory: File Length Name/status 1 15694836 /c2500-js-l.122-10b [15694900 bytes used, 1082316 available, 16777216 total] Accessing file '/c2500-js-l.122-10b' on 10.10.10.1... Loading /c2500-js-l.122-10b from 10.10.10.1 (via Ethernet0): ! [OK] Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeee ...erased Loading /c2500-js-l.122-10b from 10.10.10.1 (via Ethernet0): !!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!! [OK - 15694836/16777216 bytes] Verifying checksum... OK (0x58D2) !--- System Image file has been successfully copied Flash copy took 0:07:37 [hh:mm:ss] %FLH: Re-booting system after download F3: 14732748+962056+889336 at 0x3000060 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) 2500 Software (C2500-JS-L), Version 12.2(10b), RELEASE SOFTWARE (fc1) Copyright (c) 1986-2002 by cisco Systems, Inc. ..........
验证新的系统镜像是否成功复制到 Router2 的闪存中。
Router2#show flash System flash directory: File Length Name/status 1 15694836 /c2500-js-l.122-10b !--- Cisco IOS image file has been copied [15694900 bytes used, 1082316 available, 16777216 total] 16384K bytes of processor board System flash (Read ONLY)
* 只有在使用从闪存中运行的系统时路由器才会重新加载。有关详情,请参阅复制到从闪存中运行的系统的闪存
注意:要将启动配置文件从一台设备复制到另一台设备,请参阅使用 TFTP 复制配置文件。