how to copy configuration files to and from the cisco ios routers that use SNMP

Unanswered Question
Apr 30th, 2010
User Badges:

Hello,

I went on the page : https://supportforums.cisco.com/docs/DOC-1860

You explain how to get a config file and send it to a tftp server or oppositely.


I face this problem:


id090365:~> snmpset -v2c -c communitystring hostipaddress .1.3.6.1.4.1.9.9.96.1.1.1.1.2.98 i 1
Error in packet.
Reason: noCreation (That table does not support row creation or that object can not ever be created)
Failed object: SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.2.98

Do you have any idea?


Thanks,


Olivier

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Joe Clarke Fri, 04/30/2010 - 12:54
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

If you're following step 1, you need to do all those SETs in ONE request.  That is, all on one line:


snmpset -v2c -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
grnelson Tue, 05/04/2010 - 15:48
User Badges:

I was able to get the example from the following web page to work using numeric OID's.

http://www.cisco.com/en/US/tech/tk648/tk362/technologies_configuration_example09186a0080094aa6.shtml#app


I am now trying to use object names as shown in the example and having difficulty.


I am using the net-snmp package on Fedora Linux.


I copied the following MIB files from Cisco's web site to $HOME/.snmp/mibs/ .


-rw-r--r-- 1 root root 31618 2010-05-03 20:15 CISCO-CONFIG-COPY-MIB.my

-rw-r--r-- 1 root root 15375 2010-05-03 20:10 CISCO-SMI-V1SMI.my

-rw-r--r-- 1 root root 10529 2010-05-01 11:34 SNMPv2-SMI.my

-rw-r--r-- 1 root root 29165 2010-05-03 20:12 SNMPv2-TC-V1SMI.my


I created a snmp.conf file in $HOME/.snmp/snmp.conf which contains the

following:


mibs +SNMPv2-SMI

mibs +SNMPv2-TC-V1SMI

mibs +CISCO-SMI-V1SMI

mibs +CISCO-CONFIG-COPY-MIB


When I run my procedure I get the following.....


+ snmpset -v2c -c 192.168.8.1 ccCopyProtocol.111 i 1 ccCopySourceFileType.111 i 4 ccCopyDestFileType.111 i ccCopyServerAddress.111 a tftpserver ccCopyFileName.111 s destfile ccCopyEntryRowStatus.111 i 4

Cannot find module (SNMPv2-TC-V1SMI): At line 0 in (none)

Cannot find module (CISCO-SMI-V1SMI): At line 0 in (none)

Cannot find module (SNMPv2-SMI-v1): At line 11 in /root/.snmp/mibs/CISCO-SMI-V1SMI.my

Cannot find module (CISCO-ST-TC): At line 40 in /root/.snmp/mibs/CISCO-CONFIG-COPY-MIB.my

Did not find 'FcNameIdOrZero' in module #-1 (/root/.snmp/mibs/CISCO-CONFIG-COPY-MIB.my)

i: Bad object type: 4



There seems to be a problem with Cisco's MIB files.


Examining the SNMPv2-TC-V1SMI.my file shows the name of the module it

contains is:

SNMPv2-TC-v1 DEFINITIONS ::= BEGIN

which does not match the file name or the name Cisco uses when referring to the MIB on its web site.



Examining the CISCO-SMI-V1SMI.my file shows the name of the module it

contains is:

CISCO-SMI DEFINITIONS ::= BEGIN

which does not match the file name or the name Cisco uses when referring to the MIB on its web site.


The web page cited above says the following:


These MIBs are used:


    *        CISCO-SMI-V1SMI.my

    *         SNMPv2-TC-V1SMI.my

    *        CISCO-CONFIG-COPY-MIB-V1SMI.my

    *        CISCO-FLASH-MIB.my


In other words it lists the MIB files, not the actual module names.


If you click the following link in the web page example it takes you to a page where the MIB is referred to as

http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&mibName=CISCO-SMI-V1SMI


On this page the MIB is referred to in two places as CISCO-SMI-V1SMI.

This is not the MIB module name.


Cisco should be consistent when referring to MIBs in its documentation. Either use the module name and indicate it is the module name.

Or use the file name and inidcate it is the file name and the module name is needed when using the MIB in a script or program.

grnelson Tue, 05/04/2010 - 16:48
User Badges:

I was finally able to get the example working using Object Names rather than numeric OID's.


I had to download a couple of additional MIB files from Cisco's web site and comment out the ones with inconsistent module names.


Here is the snmp.conf file that worked..


[[email protected] r65]# cat /root/.snmp/snmp.conf
mibs +SNMPv2-SMI
#mibs +SNMPv2-TC-V1SMI
mibs +SNMPv2-TC-v1
mibs +CISCO-SMI
#mibs +CISCO-SMI-V1SMI
mibs +CISCO-ST-TC
mibs +CISCO-CONFIG-COPY-MIB


Output from the script......


+ snmpset -v2c -c 192.168.8.1 ccCopyProtocol.111 i 1 ccCopySourceFileType.111 i 4 ccCopyDestFileType.111 i 1 ccCopyServerAddress.111 a 192.168.11.11 ccCopyFileName.111 s cfg/r65/gcw-r65-5dwhi.cfg ccCopyEntryRowStatus.111 i 4
CISCO-CONFIG-COPY-MIB::ccCopyProtocol.111 = INTEGER: tftp(1)
CISCO-CONFIG-COPY-MIB::ccCopySourceFileType.111 = INTEGER: runningConfig(4)
CISCO-CONFIG-COPY-MIB::ccCopyDestFileType.111 = INTEGER: networkFile(1)
CISCO-CONFIG-COPY-MIB::ccCopyServerAddress.111 = IpAddress: 192.168.11.11
CISCO-CONFIG-COPY-MIB::ccCopyFileName.111 = STRING: cfg/r65/gcw-r65-5dwhi.cfg
CISCO-CONFIG-COPY-MIB::ccCopyEntryRowStatus.111 = INTEGER: createAndGo(4)

id090365_warnier Tue, 05/04/2010 - 23:48
User Badges:

Thanks a lot in advance for this example.

I need to get access to my cat /root/.snmp/snmp.conf, then I will try and give feedback.

Thanks,

Olivier

Cody Hartley Wed, 07/30/2014 - 08:58
User Badges:

I hadn't seen any snmp guides using snmpv3 and scp as transport protocol. For those looking to implement, here is what worked for me.

As with the other snmp config copy guides you will need to download the respective MIBS and load them in the snmp.conf file.

This post will specifically cover the snmpset commands for a v3 setup.

SNMP Environment:

Name        : net-snmp
Version     : 5.7.2
Release     : 17.fc20
 

snmp conf file in ~/.snmp/snmp.conf

   contains

defSecurityName XXX <- replace with v3 username
defContext ""
defAuthType SHA
defPrivType AES
defSecurityLevel authPriv
defAuthPassphrase ***** <-replace with authentication pass
defPrivPassphrase *****  <-replace with encryption pass
defVersion 3
showMibErrors no
mibs ALL

I would verify basic snmpv3 functionality with a snmpwalk of something simple like sysUpTime. When that's good proceed to the CONFIG-COPY snmp commands.

 

This is my bash script that does the entire copy asking only for a single argument of IP/Hostname of the device being backed up. The 2>/dev/null shown in the script or at the cli below redirects STDERR to null to avoid the MIB modules parsing errors.

#!/usr/bin/bash
DEVICE=$1
RANNUM=42
USER=******
PASS=******
SERVER=X.X.X.X
DATE=$(date +"%m_%d_%y")

snmpset $DEVICE ccCopyProtocol.$RANNUM i 4 ccCopySourceFileType.$RANNUM i 4 ccCopyDestFileType.$RANNUM i 1 ccCopyServerAddress.$RANNUM a "$SERVER" ccCopyFileName.$RANNUM s "$DEVICE.$DATE" ccCopyUserName.$RANNUM s $USER ccCopyUserPassword.$RANNUM s $PASS ccCopyEntryRowStatus.$RANNUM i 4 2>/dev/null

 

Once run you can check the status of the copy with the following command.

[[email protected] hlsb]# snmpwalk sbs-tech-switch ciscoConfigCopyMIB 2>/dev/null
CISCO-CONFIG-COPY-MIB::ccCopyProtocol.42 = INTEGER: scp(4)
CISCO-CONFIG-COPY-MIB::ccCopySourceFileType.42 = INTEGER: runningConfig(4)
CISCO-CONFIG-COPY-MIB::ccCopyDestFileType.42 = INTEGER: networkFile(1)
CISCO-CONFIG-COPY-MIB::ccCopyServerAddress.42 = IpAddress: 10.10.10.193
CISCO-CONFIG-COPY-MIB::ccCopyFileName.42 = STRING: sbs-tech-switch.07_09_14
CISCO-CONFIG-COPY-MIB::ccCopyUserName.42 = STRING: XXXX
CISCO-CONFIG-COPY-MIB::ccCopyUserPassword.42 = STRING: XXXX
CISCO-CONFIG-COPY-MIB::ccCopyNotificationOnCompletion.42 = INTEGER: false(2)
CISCO-CONFIG-COPY-MIB::ccCopyState.42 = INTEGER: successful(3)
CISCO-CONFIG-COPY-MIB::ccCopyTimeStarted.42 = Timeticks: (52270199) 6 days, 1:11:41.99
CISCO-CONFIG-COPY-MIB::ccCopyTimeCompleted.42 = Timeticks: (52270339) 6 days, 1:11:43.39
CISCO-CONFIG-COPY-MIB::ccCopyEntryRowStatus.42 = INTEGER: active(1)
CISCO-CONFIG-COPY-MIB::ccCopyServerAddressType.42 = INTEGER: ipv4(1)
CISCO-CONFIG-COPY-MIB::ccCopyServerAddressRev1.42 = STRING: "10.10.10.193"

 

After the successful copy completes the entry will exist for five minutes allowing for no further requests to be made with that particular random number. To send another request prior to the five minute clearing of the table send a "destroy" snmpset to clear the entry.

 

[[email protected] hlse]# snmpset sbs-tech-switch CISCO-CONFIG-COPY-MIB::ccCopyEntryRowStatus.42 i 6 2>/dev/null
CISCO-CONFIG-COPY-MIB::ccCopyEntryRowStatus.42 = INTEGER: destroy(6)

 

Hope this will save some time for those looking to implement a more secure snmp config copy setup.

V/R

Cody Hartley

 

 

Actions

This Discussion