Using SNMP to download running-configuration from Cisco router via SCP

We know that SNMP can be used for many tasks apart from monitoring. One of them is to download configuration from the networking device. For this purpose we use SNMP SET commands to set the required variables on the router and then trigger the download.

In this blog I will concentrate on SCP(Secure copy)  as a transfer protocol.

 

ISR4k SCP transfer with SNMP SET command
SCP Transfer

 

Following is the whole process :

  • SNMP server sends a set of SNMP SET commands to router.
  •  Router configures those variables as per the SET command sent by the server.
  • At last SNMP server sends the SET command to initiate the transfer.
  • Now the router initiates the SCP session with the SCP server.
  •  Once the session is established, the transfer starts.

In this setup I have used Solarwinds SCP server  tool  on my windows PC. And for SNMP set commands I have used snmpset.exe software

On cisco router you need to have SSH enabled because SCP uses SSH to connect and transfer the files.Once SSH is enabled make sure you are able to login to the router with SSH and also able to ping SCP server from router. To enabled SCP there is just a single command:

Router (config)#ip scp server enable

 

Once this is done you can start SNMP SET in command prompt and execute below SNMP SET commands to send the parameter values to the router.

 

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1
.4.1.9.9.96.1.1.1.1.14.111 -tp:int -val:5 -----> clearing any previously set values on router

OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.2.111 -tp:int -val:4  ------> "4" indicates SCP 

OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.3.111 -tp:int -val:4 --------> "4" router running configuration 


OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.4.111 -tp:int -val:1 ------> Destination file type

OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.5.111 -tp:ip -val:10.10.10.1------->SCP server IP address 


OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.6.111 -tp:str -val:runni.txt ------> File name with you want to save configuration file.


OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.7.111 -tp:str -val:cisco -----------> SCP username


OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.8.111 -tp:str -val:cisco ---------->SCP password


OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.15.111 -tp:int -val:1


OK

C:\Users\shambhu\Desktop>SnmpSet.exe -r:192.168.10.1 -c:"cisco" -o:1.3.6.1.4.1
.9.9.96.1.1.1.1.14.111 -tp:int -val:1 -----> Activates transfer 

 

You can check your SCP directory to find out if the copy was successful.

SCP-Copy


Leave a Reply