[c-nsp] OT: snmp oid for fetching entire router config

Enno Rey erey at ernw.de
Tue Oct 5 12:53:23 EDT 2004


Hi,

yes, that's entirely possible.
Have a look at 

[12] How To Copy Configurations To and From Cisco Devices Using SNMP (IOS >= 12.0):
http://www.cisco.com/en/US/tech/tk648/tk362/technologies_tech_note09186a0080094aa6.shtml 
[13] Moving Files and Images Between a Router and TFTP Server via SNMP (IOS < 12.0):
http://www.cisco.com/en/US/tech/tk648/tk362/technologies_tech_note09186a008009463e.shtml 

a sample application can look like this:

[erey at ws23]$ snmpset -v 1 -c r0sebud 192.168.96.1 ccCopyProtocol.111 i 1 ccCopySourceFileType.111 i 4 ccCopyDestFileType.111 i 1 ccCopyServerAddress.111 a 192.168.96.9 ccCopyFileName.111 s router-config 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.96.9
CISCO-CONFIG-COPY-MIB::ccCopyFileName.111 = STRING: router-config
CISCO-CONFIG-COPY-MIB::ccCopyEntryRowStatus.111 = INTEGER: createAndGo(4)
[erey at ws23]$

this copies the running-config to a tftp server at 192.168.96.9

beware: it can be a _real_ pain to get the correct syntax. Pay attention to the correct spelling of the OIDs, the data types (full form vs. abbreviation, see man page of snmpset) & their spelling (e.g. octet string vs. OCTETSTRING). You'll probably have to take a closer look at the MIB's 'source code' (here the CISCO-CONFIG-COPY-MIB-V1SMI).
And, btw, you need the right MIBs ;-)), e.g.

[erey at mobile]$ cd /usr/share/snmp/mibs/
[erey at mobile]$ wget --passive-ftp ftp://ftp.cisco.com/pub/mibs/v1/CISCO-SMI-V1SMI.my
--10:56:23--  ftp://ftp.cisco.com/pub/mibs/v1/CISCO-SMI-V1SMI.my
           => `CISCO-SMI-V1SMI.my'
Resolving ftp.cisco.com... done.
Connecting to ftp.cisco.com[64.102.255.95]:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /pub/mibs/v1 ... done.
==> PASV ... done.    ==> RETR CISCO-SMI-V1SMI.my ... done.


    [<=>                                  ] 0             --.--K/s             
    [ <=>                                 ] 9,666         33.71K/s             
    [  <=>                                ] 9,666         33.71K/s             

10:56:29 (33.71 KB/s) - `CISCO-SMI-V1SMI.my' saved [9666]

[erey at mobile]$ wget --passive-ftp ftp://ftp.cisco.com/pub/mibs/v1/SNMPv2-TC-V1SMI.my
--11:03:32--  ftp://ftp.cisco.com/pub/mibs/v1/SNMPv2-TC-V1SMI.my
           => `SNMPv2-TC-V1SMI.my'
Resolving ftp.cisco.com... done.
...
[erey at mobile]$ wget --passive-ftp ftp://ftp.cisco.com/pub/mibs/v1/CISCO-CONFIG-COPY-MIB-V1SMI.my
[erey at mobile]$ wget --passive-ftp ftp://ftp.cisco.com/pub/mibs/v1/CISCO-FLASH-MIB-V1SMI.my
[erey at mobile]$ wget --passive-ftp ftp://ftp.cisco.com/pub/mibs/v1/ENTITY-MIB-V1SMI.my
[erey at mobile]$ wget --passive-ftp ftp://ftp.cisco.com/pub/mibs/v1/SNMPv2-SMI-V1SMI.my


--------

in short: don't expect it to work on your first try. But, yes, it works...

thanks,

Enno










   




On Tue, Oct 05, 2004 at 01:59:01PM +0530, Amol Sapkal wrote:
> Guys,
> Is there is any way to fetch the entire running config from a router
> via a snmpget or walk?
> 
> I was looking at backing up my configs without using the standard
> telnet unix script.
> 
> 
> -- 
> Warm Regds,
> 
> Amol Sapkal
> 
> --------------------------------------------------------------------
> An eye for an eye makes the whole world blind 
> - Mahatma Gandhi
> --------------------------------------------------------------------
> _______________________________________________
> cisco-nsp mailing list  cisco-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-nsp
> archive at http://puck.nether.net/pipermail/cisco-nsp/

-- 
Enno Rey

ERNW Enno Rey Netzwerke GmbH - Zaehringerstr. 46 - 69115 Heidelberg
Tel. +49 6221 480390 - Fax 6221 419008 - Mobil +49 173 6745902
www.ernw.de - PGP 055F B3F3 FE9D 71DD C0D5  444E C611 033E 3296 1CC1 


More information about the cisco-nsp mailing list