A quick reference guide to commanding a cisco switch or router to write out it's config using only snmp.
Second, I am assuming here that you're using the net-snmp package, available from sourceforge.
What | Symbolic | OID | Command Line | |
---|---|---|---|---|
Set the target tftp server | tftpHost | .1.3.6.1.4.1.9.5.1.5.1 | snmpset -IR SWITCH WRCOMM tftpHost.0 s targetserver | |
Set the target filename | tftpFile | .1.3.6.1.4.1.9.5.1.5.2 | snmpset -IR SWITCH WRCOMM tftpFile.0 s filename | |
Tell the switch which line card's config to upload (in this case, slot 1) | tftpModule | .1.3.6.1.4.1.9.5.1.5.3 | snmpset -IR SWITCH WRCOMM tftpModule.0 i 1 | |
Instruct the switch to begin uploading the config Options: 2 -> d/l config 3-> upload config 4-> download os sw 5->upload os sw 6-> download firmware 7-> upload firmware |
tftpAction | .1.3.6.1.4.1.9.5.1.5.4 | snmpset -IR SWITCH WRCOMM tftpAction.0 i 3 | |
Wait for a result code | tftpResult | .1.3.6.1.4.1.9.5.1.5.5 | snmpget -IR SWITCH WRCOMM tftpResult.0 |
tftpResult codes can be:
If you want to do this symbolically, you'll need the CISCO-CONFIG-COPY mib.
For the purposes of this demonstration, we'll use entry # 26.
What | Symbolic | OID | Command Line |
---|---|---|---|
Set the source to be the running-config | ccCopySourceFileType | .1.3.6.1.4.1.9.9.96.1.1.1.1.3 | snmpset -IR iosdevice wrcomm ccCopySourceFileType.26 i 4 |
Set the dest to be the startup-config | ccCopyDestFileType | .1.3.6.1.4.1.9.9.96.1.1.1.1.4 | snmpset -IR iosdevice wrcomm ccCopySourceFileType.26 i 3 |
Start the transfer (set this variable to 1, aka "active") | ccCopyEntryRowStatus | .1.3.6.1.4.1.9.9.96.1.1.1.1.14 | snmpset -IR iosdevice wrcomm ccCopyEntryRowStatus.26 i 1 |
Check the status of the transfer | ccCopyState | .1.3.6.1.4.1.9.9.96.1.1.1.1.10 | snmpget -IR iosdevice wrcomm ccCopyState.26 |