Category:Cisco Systems -> Routing and Switching
How to get running configuration via SNMP
First, you need a special utility software like Net-SNMP. It works under MS Windows. Net-SNMP is a freeware tool. You can download it from the official web-site or right from here: File:net snmp 5.4.2.1 1.win32.zip
Place the files from the archive into a folder and add a system path to it by going to My Computer - System Properties - Advanced - Environment Variables.
Create a file with the extension of .bat or .cmd. For example you made getcfg.cmd file. Now you need to place the following lines into it:
snmpset -v 1 -c write %1 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.333 i 1
snmpset -v 1 -c write %1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.333 i 4
snmpset -v 1 -c write %1 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.333 i 1
snmpset -v 1 -c write %1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.333 a 172.16.205.6 //tftp server address
snmpset -v 1 -c write %1 .1.3.6.1.4.1.9.9.96.1.1.1.1.6.333 s "%1-cfg" // Filename
snmpset -v 1 -c write %1 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.333 i 1
// Where "write" is the community name. It MUST have write privileges!
// %1 is a variable for the device IP address. The variable is announced after the batch file in CLI, see below.
Here is how to use it. Run tftpd32 or whatever you are using to start a TFTP service. Then type in the command line (cmd.exe) the following, for example: getcfg.cmd 172.16.1.10. The script will create a new file 172.16.1.10-cfg with the actual configuration retrieved from the device.
Basic commands to configure community with Read/Write access:
access-list 10 permit 192.168.1.40
!
snmp-server community write RW 10 // Don't use "write" for the community name ever in real!
SNMPv3 configuration example:
!* Configure target SNMP server SNMPv3 - AES
snmp-server view <name> iso included
snmp-server group <group_name> v3 priv read <name> notify <name>
snmp-server user <name> <group_name> v3 auth sha <auth-key> priv aes 128 <enc-key>
snmp-server host 1.1.1.1 ver 3 priv <name>
snmp-server host 2.2.2.2 ver 3 priv <name>