cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7026
Views
0
Helpful
0
Comments
Maria Palmero Amador
Cisco Employee
Cisco Employee

 

How to transfer a file to a router via SNMP, CISCO-FLASH-MIB

 

The examples below show how to copy a file from a tftp server to the flash via snmp, similar to

Router#copy tftp flash

Via SNMP the same operation can be performed from different sources:

  1. "snmp set/get" commands run from the Router. When running snmp manager function,
  2. "snmpset" commands applied from a Network Management Station running a snmp utility, or
      1. "snmp_setany" commands applied from TCL shell in the router.

 

"snmp set/get" commands run from the Router

 

Those commands are hidden, with the advantage to configure&monitor via snmp from the router itself, without having to involve any NetworkManagement Station.

Here the configuration steps you need to execute:

 

  • Enable "snmp-server manager" in the Router
Router(config)#snmp-server manager
  • Run following commands from the enable mode in the router:

Router#snmp set v2c 10.1.0.2 private oid 1.3.6.1.4.1.9.9.10.1.2.1.1.11.666 integer 6

Router#snmp set v2c 10.1.0.2 private oid 1.3.6.1.4.1.9.9.10.1.2.1.1.11.666 integer 5
Router#snmp set v2c 10.1.0.2 private oid 1.3.6.1.4.1.9.9.10.1.2.1.1.2.666 integer 2
Router#snmp set v2c 10.1.0.2 private oid 1.3.6.1.4.1.9.9.10.1.2.1.1.3.666 integer 1
Router#snmp set v2c 10.1.0.2 private oid 1.3.6.1.4.1.9.9.10.1.2.1.1.4.666 ip-address 10.1.0.99
Router#snmp set v2c 10.1.0.2 private oid 1.3.6.1.4.1.9.9.10.1.2.1.1.5.666 string test
Router#snmp set v2c 10.1.0.2 private oid 1.3.6.1.4.1.9.9.10.1.2.1.1.6.666 string test
Router#snmp set v2c 10.1.0.2 private oid 1.3.6.1.4.1.9.9.10.1.2.1.1.11.666 integer 1

 Note: "private" is the rw community string 10.1.0.2 is the ip address of the router 10.1.0.99 is the tftp server test is the file we want to move from tftp server to flash1.3.6.1.4.1.9.9.10.1.2.1.1.5 and 1.3.6.1.4.1.9.9.10.1.2.1.1.6 correspond ciscoFlashCopySourceName and ciscoFlashCopyDestinationName respectivaly

 

  • snmp set syntax
snmp *set* {v1|v2c} <address> <community> [retries <n>]  [timeout <seconds>]
oid <object identifier> {integer|string| counter| gauge| ip-address} <value>
   

"snmpset" commands applied from a Network Management Station

 

Same exampled applied from Network Management Station, running snmpset commands(net-snmp implementation, version 5.0.9) "snmpset" from NMS

 

NMS#snmpset -v 2c -c private 10.1.0.2 1.3.6.1.4.1.9.9.10.1.2.1.1.11.666  i 6
NMS#snmpset -v 2c -c private 10.1.0.2 1.3.6.1.4.1.9.9.10.1.2.1.1.11.666  i 5
NMS#snmpset -v 2c -c private 10.1.0.2 1.3.6.1.4.1.9.9.10.1.2.1.1.2.666 i 2
NMS#snmpset -v 2c -c private 10.1.0.2 1.3.6.1.4.1.9.9.10.1.2.1.1.3.666 integer 1
NMS#snmpset -v 2c -c private 10.1.0.2  1.3.6.1.4.1.9.9.10.1.2.1.1.4.666 a 10.1.0.99
NMS#snmpset -v 2c -c private 10.1.0.2  1.3.6.1.4.1.9.9.10.1.2.1.1.5.666 string test
NMS#snmpset -v 2c -c private 10.1.0.2  1.3.6.1.4.1.9.9.10.1.2.1.1.6.666 string test
NMS#snmpset -v 2c -c private 10.1.0.2  1.3.6.1.4.1.9.9.10.1.2.1.1.11.666 i 1

"snmp_setany" commands applied from TCL shell

 

Same example applied from tclsh, running snmp_setany commands(TCL 8.3.4) "snmpset" from tcl shell

 

Router#tclsh
Router(tcl)#
Router(tcl)#snmp_setany private 1.3.6.1.4.1.9.9.10.1.2.1.1.11.666 -i 6
Router(tcl)#snmp_setany private 1.3.6.1.4.1.9.9.10.1.2.1.1.11.666 -i 5
Router(tcl)#snmp_setany private 1.3.6.1.4.1.9.9.10.1.2.1.1.2.666 -i 2
Router(tcl)#snmp_setany private 1.3.6.1.4.1.9.9.10.1.3.1.1.3.666 -i 1
Router(tcl)#snmp_setany private 1.3.6.1.4.1.9.9.10.1.2.1.1.4.666 -ipv4 10.1.0.99
Router(tcl)#snmp_setany private 1.3.6.1.4.1.9.9.10.1.2.1.1.5.666 -d test
Router(tcl)#snmp_setany private 1.3.6.1.4.1.9.9.10.1.2.1.1.6.666 -d test
Router(tcl)#snmp_setany private 1.3.6.1.4.1.9.9.10.1.2.1.1.11.666 -i 1

 

References

 

 
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: