Discussion:
How to set octed string in Hex bytes in SET command?
(too old to reply)
Vesta
2016-06-04 00:34:37 UTC
Permalink
Net-snmp-5.5-1.x86.exe for Win32

I need set IP addreess in 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.

What is correct input format for SNMPSET to set Hex values I need?

Best Regards,
Jeroen van Ingen
2016-06-08 14:09:10 UTC
Permalink
Hi Vesta,

The correct syntax is to enclose the hex string value in quotes.
Whitespace separates arguments to a command, so if a single argument
(like the value you want to set) contains whitespace, it should be
quoted. Otherwise the snmpset commands thinks that "C0" is the value to
set, "A8" is another argument (that will be interpreted as OID), "64" is
the type for OID "A8" and the last "64" is the value for OID "A8".

So,

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

should work. Using another object as an example:

***@jeroen:~$ snmpwalk -c private hp-2530g
LLDP-MIB::lldpConfigManAddrPortsTxEnableLLDP-MIB::lldpConfigManAddrPortsTxEnable.ipV4.".e.."
= Hex-STRING: FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

***@jeroen:~$ snmpset -c private hp-2530g
.1.0.8802.1.1.2.1.1.7.1.1.1.4.10.101.1.148 x "00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00"
LLDP-MIB::lldpConfigManAddrPortsTxEnable.ipV4.".e.." = Hex-STRING: 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00

(I used fully numeric OID in the snmpset because of the index into the
table, didn't care to look for a read-write object with hex-string
syntax that's not in a table)

Regards,
Jeroen
Post by Vesta
Net-snmp-5.5-1.x86.exe for Win32
I need set IP addreess in 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
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.
What is correct input format for SNMPSET to set Hex values I need?
Best Regards,
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Net-snmp-users mailing list
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Loading...