on 06-18-2009 03:49 PM
This procedure is based on CISCO-CONFIG-COPY-MIB, generally available from Cisco IOS releases 12.0.
Management Information Base (MIB) objects used for the config transfer are present under the ccCopyTable of the MIB.
MIB Object Name | Object Identifier | Values used in the example |
ccCopyEntryRowStatus | .1.3.6.1.4.1.9.9.96.1.1.1.1.14 | active (1) |
ccCopyProtocol | 1.3.6.1.4.1.9.9.96.1.1.1.1.2 | tftp(1) |
ccCopySourceFileType | .1.3.6.1.4.1.9.9.96.1.1.1.1.3 | networkFile(1) |
ccCopyDestFileType | .1.3.6.1.4.1.9.9.96.1.1.1.1.4 | |
ccCopyServerAddress | .1.3.6.1.4.1.9.9.96.1.1.1.1.5 | |
ccCopyFileName | .1.3.6.1.4.1.9.9.96.1.1.1.1.6 | |
ccCopyState | .1.3.6.1.4.1.9.9.96.1.1.1.1.10 | waiting(1) running(2) successful(3) failed(4) |
This is the procedure to copy the running configuration from a Cisco IOS router to a TFTP server:
snmpset -v 2c -c .1.3.6.1.4.1.9.9.96.1.1.1.1.2. i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3. i 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4. i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5. a "" .1.3.6.1.4.1.9.9.96.1.1.1.1.6. s "" .1.3.6.1.4.1.9.9.96.1.1.1.1.14. i 4
snmpwalk -v 2c -c .1.3.6.1.4.1.9.9.96.1.1.1.1.10.
Repeat the command until the state is successful.
snmpset -v 2c -c .1.3.6.1.4.1.9.9.96.1.1.1.1.14. i 6
These are examples of each step:
Cisco IOS Router Name/IP Address: 10.0.0.1
Server IP Address: 10.0.0.2
File Name: Router.cfg
SNMP Read Write Community String: private
Random Row number:50
snmpset -v 2c -c private 10.0.0.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.50 i 1
.1.3.6.1.4.1.9.9.96.1.1.1.1.3.50 i 4
.1.3.6.1.4.1.9.9.96.1.1.1.1.4.50 i 1
.1.3.6.1.4.1.9.9.96.1.1.1.1.5.50 a "10.0.0.2"
.1.3.6.1.4.1.9.9.96.1.1.1.1.6.50 s "Router.cfg"
.1.3.6.1.4.1.9.9.96.1.1.1.1.14.50 i 4
2. Checking the transfer status. Repeat checking until the status is successful.
snmpwalk -v 2c -c private 10.0.0.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.10.50
3. Destroying the row.
snmpset -v 2c -c private 10.0.0.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.50 i 6
I noticed that the mib known as ".1.3.6.1.4.1.9.9.96.1.1.1.1.14.X" is referenced in several places. As I mentioned in my initial comment, the ISR4331 I am working with (plus 200 more) does not respond to the ".1.3.6.1.4.1.9.9.96.1.1.1.1.14.X i 4" at all. The router states it doesn't exist. When I SNMPWALK the CISCO-CONFIG-COPY-MIB, that particular one doesn't show up at all.
Still my question remains - how do I kick off the jobs?
When I attempt to kick off the job (from a Linux platform) with the following command:
snmpset <router> .1.3.6.1.4.1.9.9.96.1.1.1.1.14.135 i 4
I get the following results:
=============================================================
Error in packet
Reason: inconsistentValue (The set value is illegal or unsupported in some way)
Failed object: SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.14.135
=============================================================
Complete tested steps for copy running config from cisco switch to Linux tftp server
Topology
Linux SERVER with snmp and tftp installed has ip 192.168.12.200 <------> Cisco switch 192.168.13.13
Process to copy running config from Cisco switch to TFTP server (TFTP server running on Liunux)
- The switch should be configured with snmp read write community with appropriate acl allowing the the ip address from where you will initiate the snmpset. This has been tested with
Switch Ports Model SW Version SW Image
------ ----- ----- ---------- ----------
* 1 26 WS-C2960-24PC-L 15.0(1)SE2 C2960-LANBASEK9-M
Switch#
conf t
snmp-server community TESTCOMM RW 3
access-list 3 permit 192.168.12.200
Where 3 is the standard access-list allowing the ip address from where you will run snmpset
- From the Linux server's shell issue the following commands
snmpset -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.50 i 6
in the command above
2c tells to use snmp v2
TESTCOMM is the community string ( for authentication)
192.168.13.13 is an ip address of Cisco switch
.1.3.6.1.4.1.9.9.96.1.1.1.1.14.50 OID ending with .50 where .50 is random number, which will consistent throughout the whole process.
The above command remove table/row/entry 50 if it previously existed, it is good practice to start fresh
snmpset -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.50 i 1
ConfigCopyProtocol is set to TFTP
snmpset -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.50 i 4
Set the SourceFileType to running-config
snmpset -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.50 i 1
Set the DestinationFileType to networkfile
snmpset -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.50 a "192.168.12.200"
Sets the ccCopyServerAddress to the IP address of the TFTP server
snmpset -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.6.50 s "Switch-running-config-192.168.13.13.cfg"
Sets the ccCopyFileName to your desired file name at destination tftp server. In my case, tftp was running on the Linux server from where I was also sending snmpset command, tftp directory was /srv/tftp. I had to create an empty file because privileged user and staff group owned directory.
Used command below
touch /srv/tftp/Switch-running-config-192.168.13.13.cfg
chmod 777 /srv/tftp/Switch-running-config-192.168.13.13.cfg
snmpset -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.50 i 1
Sets to start copying running config to tftp server
verify tftp config transfer by
snmpwalk -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.10.50
the output will show one of the following sates of ConfigCopyState
waiting(1)
running(2)
successful(3)
failed(4)
snmpset -v 2c -c TESTCOMM 192.168.13.13 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.50 i 6
Remove table/row/entry 50, the one create at the begining, it is good practice to exit clean.
Issue command on Linux box to verify the file copied across
ls -ltr /srv/tftp/Switch-running-config-192.168.13.13.cfg
You can also transfer startup-config, IOS images using ftp,SFTP SCP etc.
Have a read on CISCO-CONFIG-COPY-MIB.oid at
https://mibs.cloudapps.cisco.com/ITDIT/MIBS/MainServlet?ReleaseSel=3982&PlatformSel=353&fsSel=1146
https://mibs.cloudapps.cisco.com/ITDIT/MIBS/MainServlet
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: