Introduction
This document describes how to move configuration files and software images between a router and a Trivial File Transfer Protocol (TFTP) server.
Prerequisites
Requirements
Readers of this document must be knowledgeable of SNMP and MIBs.
Components Used
The information in this document is based Cisco IOS® Software Release 10.2 or later. The MIBs that these examples use areOLD-CISCO-SYS-MIBandOLD-CISCO-FLASH-MIB, which are supported in Cisco IOS Software Release 10.2 and later. Cisco recommends that you use a more recent release of Cisco IOS software such as Cisco IOS Software Release 12.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
Conventions
In all the examples that this document shows, these values are used for illustration purposes:
-
172.16.99.20—IP address of the router.
-
10.68.191.135—IP address of the TFTP server.
-
private—SNMP read-write community string. Make sure that you use the read-write string configured on your router. Issue theshow running-configcommand on the router CLI in order to verify this.
-
The syntax for when you issue thesnmpsetandsnmpwalkcommands are in these examples:
snmpset [options...] <hostname> {<community>} [<objectID> <type> <value> ...]
snmpwalk [options...] <hostname> {<community>} [<objectID>]
Note: In order to increase the timeout, use the -t <timeticks> option in the snmpset command.
For more information on document conventions, refer to Cisco Technical Tips Conventions .
Background Information
Verify that you can ping the IP address of the TFTP server from the router:
Router#ping 10.68.191.135
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.68.191.135, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms:
The procedures are:
-
Not applicable for Catalyst switches based on Cisco IOS software, such as the Catalyst 2900/3500XL series.
-
Not applicable for Catalyst switches based on CatOS software, such as the Catalyst 4000/5000/6000 series.
-
Not applicable for Catalyst 6000 series Multilayer Switch Feature Card (MSFC) and MSFC2 modules that run Cisco IOS software.
-
Not applicable if SNMP Read-Write community string in not configured or not known on the router. Refer toHow to Configure SNMP Community Strings on Routers, Cisco IOS Software-Based XL Switches, RSMs, MSFCs and Catalyst Switchesfor the detailed procedure on how to configure the SNMP community strings.
-
If you run Cisco IOS Software Release 12 or later, you must use theCISCO-CONFIG-COPY-MIB.
-
Based on command line syntax ofNET-SNMP(previously known as UCD-SNMP) Utilities. If you use some other SNMP applications like HP Open View or NetView, make sure that you verify the syntax which can be different from the one shown in the examples in this document.
-
Based onOLD-CISCO-SYS-MIBandOLD-CISCO-FLASH-MIB. The MIB objects from this MIB are used:
MIB Object Name
|
OID
|
writeNet
|
.1.3.6.1.4.1.9.2.1.55
|
hostConfigSet
|
.1.3.6.1.4.1.9.2.1.53
|
writeMem
|
.1.3.6.1.4.1.9.2.1.54
|
flashToNet
|
.1.3.6.1.4.1.9.2.10.9
|
flashErase
|
.1.3.6.1.4.1.9.2.10.6
|
netToFlash
|
.1.3.6.1.4.1.9.2.10.12
|
Copy a Running Configuration File from the Router to the TFTP Server
Step-by Step Instructions
Complete these steps:
-
Create a new file, router-config, in the /tftpboot directory of the TFTP server. On UNIX, use the syntax:touch <filename>.
touch router-config
-
Change the permissions of the file to 777 with the syntax:chmod <permissions> <filename>.
chmod 777 router-config
-
From the management station command line, with the use of the MIB objectwriteNetenter this information:
% snmpset 172.16.99.20 private .1.3.6.1.4.1.9.2.1.55.10.68.191.135
s router-config enterprises.9.2.1.55.171.68.191.135 = "router-config"
Verify the Configuration
Verify that the router-config file in the /tftpbootdirectory of the TFTP server copies over successfully.
Copy a Configuration File from the TFTP Server to the Router
Step-by Step Instructions
-
Perform one of these tasks:
-
Create a new file,router-configin the /tftpbootdirectory of the TFTP server. On UNIX, use the syntaxtouch <filename>.
touch router-config
-
Place your current configuration file in the /tftpbootdirectory of the TFTP server.
-
Change the permissions of the file to 777 with the use of the syntaxchmod <permissions> <filename>.
chmod 777 router-config
-
From the management station command line, with the use of the MIB objecthostConfigSet, enter this:
% snmpset -t 60 172.16.99.22 private .1.3.6.1.4.1.9.2.1.53.10.68.191.135
s router-config OR % snmpset -t 60 172.16.99.22 private
enterprises.9.2.1.53.171.68.191.135 = "router-config"
Where- t 60equals a timeout of 60 timeticks.
-
After the file is written to RAM, copy it to NVRAM with the use of the MIB objectwriteMem:
% snmpset -t 60 172.16.99.22 private .1.3.6.1.4.1.9.2.1.54.0 i 1
enterprises.9.2.1.54.0 = 1
Copy a Cisco IOS Image from the Router to the TFTP Server
Step-by Step Instructions
-
Perform one of these tasks:
-
Create a new file,router-image, in the /tftpbootdirectory of the TFTP server. On UNIX, use the syntaxtouch <filename>.
touch router-image
-
Use the same file name shown in theshow flashoutput in order to create the file on the /tftpbootdirectory of the TFTP server. For this example, the router listsc2600-i-mz.122-2.XAas the output for theshow flash: command.
touch c2600-i-mz.122-2.XA
-
Change the permissions of the file to 777 with syntaxchmod <permissions> <filename>.
chmod 777 c2600-i-mz.122-2.XA
-
From the management station command line, with the use of the MIB objectflashToNet, enter this information:
% snmpset 172.16.99.22 private .1.3.6.1.4.1.9.2.10.9.171.68.191.135
s c2600-i-mz.122-2.XA enterprises.9.2.10.9.171.68.191.135
= "c2600-i-mz.122-2.XA"
Verify the Configuration
After the file transfer completes, verify that the file size (bytes) is the same on the file in the /tftpbootdirectory and on the router.
Copy a Cisco IOS Image from the TFTP Server to the Router
Step-by Step Instructions
Complete these steps:
-
Place the Cisco IOS image in the /tftpbootdirectory of the TFTP server. Make sure that you consult with theSoftware Download(registeredcustomers only) .
-
Change the permissions of the file to 777 with the use of the syntaxchmod <permissions> <filename>
chmod 777 <Cisco IOS image file>
-
Before you start the file transfer via SNMP, perform adir flash:orshow flash: in order to verify that you have enough space for the new Cisco IOS image file.
If you do not have the necessary space in your Flash, the file transfer fails. Alternately, you can erase the Flash first to make room for the new Cisco IOS software via SNMP. If so, use the MIB objectflashErasecommand in order to enter this information from the management station command line:
% snmpset 172.16.99.22 private .1.3.6.1.4.1.9.2.10.6.0 i 1
enterprises.9.2.10.6.0 = 1
Note: You can also erase the router Flash manually when you issue the CLI commanderase flash:
-
Verify that the Flash is erased completely. Issue thedir flash: orshow flash:command.
Router#show flash:
System flash directory:
No files in System flash
[0 bytes used, 33030144 available, 33030144 total]
32768K bytes of processor board System flash (Read/Write)
Router #dir flash:
Directory of flash:/
No files in directory
33030144 bytes total (33030144 bytes free)
-
From the management station command line, use the MIB objectnetToFlashto enter this information in order to transfer the Cisco IOS image file to the router:
% snmpset 172.16.99.22 private .1.3.6.1.4.1.9.2.10.12.10.68.191.135
s c2600-i-mz.122-2.XA.bin enterprises.9.2.10.12.171.68.191.135
= "c2600-i-mz.122-2.XA.bin"
Note: In this example, the Cisco IOS image file,c2600-i-mz.122-2.XA.bin, is used for illustration.
-
Based upon the file size (bytes) of the Cisco IOS image, this step can take a few minutes in order to complete.
If you try to perform the CLI commanddir flash:during the file transfer on the router, this output appears. This output indicates that the file transfer has not yet completed.
Router#dir flash:
%Error opening flash:/ (Device in exclusive use)
-
Once the Cisco IOS image file transfer completes, perform the CLI commanddir flash: orshow flash:in order to verify that both the file name and the file size (bytes) exactly match with the file that is used/present in the /tftpbootdirectory of the TFTP server.
You can then set the config register to the appropriate value and reload the router (if needed) to load the new Cisco IOS image file. Refer to theCisco IOS Software Configurationdocumentation for further details on how to do this.
Appendix A
MIB Object Details
Object
|
writeNet
|
OID
|
.1.3.6.1.4.1.9.2.1.55
|
Type
|
DisplayString
|
Permission
|
write-only
|
Status
|
mandatory
|
MIB
|
OLD-CISCO-SYS-MIB
|
Description
|
Write configuration to host that uses TFTP.
|
OID in Tree
|
::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) cisco(9) local(2) lsystem(1) 55 }
|
Object
|
hostConfigSet
|
OID
|
.1.3.6.1.4.1.9.2.1.53
|
Type
|
DisplayString
|
Permission
|
write-only
|
Status
|
obsolete
|
MIB
|
OLD-CISCO-SYS-MIB
|
Description
|
Causes a new host-confg file to load with the use of TFTP.
|
OID in Tree
|
::= { ISO(1) org(3) DOD(6) Internet(1) private(4) enterprises(1) cisco(9) local(2) lsystem(1) 53 }
|
Object
|
writeMem
|
OID
|
.1.3.6.1.4.1.9.2.1.54
|
Type
|
DisplayString
|
Permission
|
write-only
|
Status
|
mandatory
|
MIB
|
OLD-CISCO-SYS-MIB
|
Description
|
Causes a new host-confg file to load with the use of TFTP.
|
OID in Tree
|
::= { ISO(1) org(3) DOD(6) Internet(1) private(4) enterprises(1) cisco(9) local(2) lsystem(1) 54 }
|
Object
|
flashToNet
|
OID
|
.1.3.6.1.4.1.9.2.10.9
|
Type
|
DisplayString
|
Permission
|
write-only
|
Status
|
mandatory
|
MIB
|
OLD-CISCO-FLASH-MIB
|
Description
|
Write Flash entry to the TFTP server. The value needs to be the name of the Flash entry to send. Instance is the IP address of the TFTP host.
|
OID in Tree
|
::= { ISO(1) org(3) DOD(6) Internet(1) private(4) enterprises(1) cisco(9) local(2) lflash(10) 9 }
|
Object
|
flashErase
|
OID
|
.1.3.6.1.4.1.9.2.10.6
|
Type
|
Integer
|
Permission
|
write-only
|
Status
|
mandatory
|
MIB
|
OLD-CISCO-FLASH-MIB
|
Description
|
Request to erase Flash memory.
|
OID in Tree
|
::= { ISO(1) org(3) DOD(6) Internet(1) private(4) enterprises(1) cisco(9) local(2) lflash(10) 6 }
|
Object
|
flashToNet
|
OID
|
.1.3.6.1.4.1.9.2.10.12
|
Type
|
DisplayString
|
Permission
|
write-only
|
Status
|
mandatory
|
MIB
|
OLD-CISCO-FLASH-MIB
|
Description
|
Write Flash entry from the TFTP server. The value needs to be the name of the Flash entry to write. Instance is the IP address of the TFTP host.
|
OID in Tree
|
::= { ISO(1) org(3) DOD(6) Internet(1) private(4) enterprises(1) cisco(9) local(2) lflash(10) 12 }
|