GET and SET Config via SNMP and tftp
 
With some snmp set command, its possible to get the running config from an Router or switch via tftp to a remote server, or copy an new connfig to a cisoc device from a tftp server.
 
Get a config to a tftp server from a Cisco Device
Sample Script, to build your own script.  
	#!/bin/bash
	#
	# cisco_get.sh
	#
	# version 0.04
	# date: 27.09.2008
	# packetlevel.ch / chw
	#
	#
	################################################################################################
	#
	# MYIP -> IP Address of the TFTP Server
	# 
	TFTPIP=192.168.2.100
	#
	# IP Address of the Cisco Devcie
	#
	IP=192.168.2.158
	#
	# or if you have a text file with ip addresses
	#
	# IP=`cat myiplist.txt`
	#
	#
	# COMM -> RW community of the Cisco Devices (some old defaults are private)
	#
	COMM=private
	#
	# MAIN Loop -> creats a file with the name $TARGET.config
	#
	for i in $IP ; 
	do {
	        echo $i 
	        TARGET=$i
	        snmpset -t 1 -c $COMM -v 1 $TARGET .1.3.6.1.4.1.9.2.1.55.$TFTPIP s "$TARGET.config" &
	   } ; done
 
Put a config to from tftp server to the Cisco Device
Sample Script, to build your own script.  
	#!/bin/bash
	#
	# cisco_put.sh
	#
	# version 0.06
	# date: 27.09.2008
	# packetlevel.ch / chw
	#
	#
	################################################################################################
	#
	# MYIP -> IP Address of the TFTP Server
	# 
	TFTPIP=192.168.2.100
	#
	# IP Address of the Cisco Devcie
	#
	IP=192.168.2.158
	#
	# or if you have a text file with ip addresses
	#
	# IP=`cat myiplist.txt`
	#
	#
	# COMM -> RW community of the Cisco Devices (some old defaults are private)
	#
	COMM=private
	#
	# MAIN Loop -> gets a file with the name $TARGET.config from the tftp server to the Cisco Devices and copy its to startup config
	#
	for i in $IP ; 
	do {
	        echo $i 
	        TARGET=$i
	        snmpset -t 1 -c $COMM -v 1 $TARGET .1.3.6.1.4.1.9.2.1.53.$TFTPIP s "$TARGET.config"
	        snmpset -t 1 -c $COMM -v 1 $TARGET .1.3.6.1.4.1.9.2.1.54.0 i 1
	   } ; done
#
# end
#
 
Scripts to download
 cisco_get.sh
 cisco_put.sh
 

(c) 2008 by packetlevel.ch / last update: 27.09.2008