Using SNMP to Modify a Router’s Running Configuration


You want to use SNMP to either download or modify a router’s configuration.


To upload or download a current copy of your router’s configuration file to a TFTP server via SNMP, you have to first configure the router for read-write SNMP access:

Router#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#snmp-server community ORARW rw

To download the current configuration file, you will need to create an empty file on your TFTP server. In this case, we assume a Unix server, although TFTP server software is available for essentially every popular operating system. Then you can send an SNMP command to the router to trigger the TFTP download:

Freebsd% touch /tftpboot/router.cfg
Freebsd% chmod 666 /tftpboot/router.cfg
Freebsd% snmpset –v1 -c ORARW Router . s router.cfg
enterprises. = "router.cfg"

You can use SNMP to trigger the router to upload a configuration file from your TFTP server via SNMP as follows:

Freebsd% echo "no ip source-route" > /tftpboot/new.cfg
Freebsd% echo "end" >> /tftpboot/new.cfg
Freebsd% chmod 666 /tftpboot/new.cfg
Freebsd% snmpset –v1 -c ORARW Router . s new.cfg
enterprises. = "new.cfg"
Freebsd% snmpset –v1 -c ORARW Router . i 1
enterprises. = 1


The ability to extract or modify your ...

Get Cisco IOS Cookbook, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.