Net-SNMP: how to specify octet string in Hex bytes in SET command?

天大地大妈咪最大 提交于 2019-12-24 16:25:21

问题


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?


回答1:


old question but maybe useful for others.

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



回答2:


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

snmpset -v 1 -c private 192.168.100.5 docsDevServerAddress.0 x 0xC0A86464



回答3:


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


来源:https://stackoverflow.com/questions/37376021/net-snmp-how-to-specify-octet-string-in-hex-bytes-in-set-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!