Cisco: Copy the running config to a TFTP server

I needed to backup (copy) the running config on a Cisco router to a TFTP server and I wanted to do it via SNMP. You'll be best served by getting CISCO-CONFIG-COPY-MIB.

num=$(expr $RANDOM % 250)
num2=$(expr $num + 1)

# Write the config (copy running to startup)
snmpset -On -m 'CISCO-CONFIG-COPY-MIB' -c writeme -v 2c 10.0.0.5 
ccCopySourceFileType.$num = 4 
ccCopyDestFileType.$num = 3 
ccCopyEntryRowStatus.$num = 4;

sleep 30

# Copy to TFTP
snmpset -On -m 'CISCO-CONFIG-COPY-MIB' -c writeme -v 2c 10.0.0.5 
ccCopyProtocol.$num2 = 1 
ccCopySourceFileType.$num2 = 3 
ccCopyDestFileType.$num2 = 1 
ccCopyServerAddress.$num2 = "10.0.0.1" 
ccCopyFileName.$num2 s 'config-backup.txt' 
ccCopyEntryRowStatus.$num2 = 4
Leave A Reply - 1 Reply
Replies
Doug 2013-02-05 07:56pm - No Email - Logged IP: 147.1.234.165

Thanks! Just what I was looking for.

All content licensed under the Creative Commons License