2

I use net-snmp-5.5-1.x86.exe for Win32

I need set IP addreess to hex format, separated by whitespace using NET-SNMP set command. For example, an IP address 192.168.100.100 converted to Hex format is 0xC0A86464

192.168.100.100 > 0xC0A86464

The correctly set value should return the following value when check with snmpget:

xxx-xxx-xxx-MIB::docsDevServerAddress.0 = Hex-STRING: C0 A8 64 64

I tried

snmpset -v 1 -c private 192.168.100.5 docsDevServerAddress.0 x 0xC0 A8 64 64

But when I using this format to set HEX address, I always got errors like this: 'A8: Bad object type: 6', or '00xA8 Bad object type: 0', and so on, depending on representation of hex format I tried. According to NET-SNMP manual, 'x' is octet string in hex bytes, separated by whitespace.

How to set correct string input format for snmpset to set Hex values I need?

4 Answers4

3

old question but maybe useful for others.

snmpset -v 1 -c private 192.168.100.5 docsDevServerAddress.0 x "C0 A8 64 64"
Allan Pinto
  • 144
  • 1
  • 1
  • 10
1

I think you should remove extra spaces inside your hex string:

snmpset -v 1 -c private 192.168.100.5 docsDevServerAddress.0 x 0xC0A86464
user2807083
  • 2,962
  • 4
  • 29
  • 37
0

Going to Necro this but this is how I was able to set multi hex values. This was done with the windows build of NetSNMP inside of PowerShell.

& '.\SnmpSet.exe' -q -r:"$ip" -v:2c -c:private -o:.1.3.6.1.4.1.13858.8.3.1.5.6 -val:0x42 -val:0x46 -tp:hex
0

You can try as below:

snmpset -v 1 -c private 192.168.100.5 docsDevServerAddress.0 x 'C0 A8 64 64'

Refer http://www.net-snmp.org/wiki/index.php/TUT:snmpset, https://linux.die.net/man/1/snmpset, https://doc.bccnsoft.com/docs/php-docs-7-en/function.snmpset.html for more information on usage of snmpset command.

logi-kal
  • 7,107
  • 6
  • 31
  • 43
Pankaj Yadav
  • 107
  • 8