NoAccess error in snmpset

2019-06-21 23:41发布

I have a MIB object with read-write permission. MIB section looks like this:

EnableHalt OBJECT-TYPE
  SYNTAX Integer32
  MAX-ACCESS read-write
  STATUS current
  DESCRIPTION "implemented in NetSnmpcodsMr.c file."
  DEFVAL { 0 }
::= { Scalars 4 }

When I do a set on this object I get:

$ sudo snmpset -v 2c -c public localhost 1.3.6.1.4.1.8072.2.2.4.0 i 1
Error in packet.
Reason: noAccess
Failed object: NET-SNMP-MIB::netSnmp.2.2.4.0

When I do a get:

$ snmpget -v 2c -c public localhost 1.3.6.1.4.1.8072.2.2.4.0
NET-SNMP-MIB::netSnmp.2.2.4.0 = INTEGER: 1

All is fine!

In snmpd.conf I added the line:

rwcommunity public localhost

Still noAccess issue. I'm using net snmp 5.4.2.1 on Ubuntu

What am I doing wrong? Please advice Thanks Gil

标签: snmp
5条回答
一夜七次
2楼-- · 2019-06-22 00:22

It's nine months since you asked this but in case it's helpful...

Is your community string correct? You specified it as "public", which is the default read-only community string. Perhaps it should be "private" instead, which is the default read-write community string.

查看更多
小情绪 Triste *
3楼-- · 2019-06-22 00:27

modify the snmpd.conf file, add below line into the end of file.Provide write permission.

rwcommunity public
查看更多
等我变得足够好
4楼-- · 2019-06-22 00:28

try:

snmpget -v 2c -c public localhost 1.3.6.1.4.1.8072.2.2.4.0 NET-SNMP-MIB::netSnmp.2.2.4.0
查看更多
家丑人穷心不美
5楼-- · 2019-06-22 00:31

Gil,

If that object is read-only, then you probably will receive notWritable instead of noAccess.

http://www.tcpipguide.com/free/t_SNMPVersion2SNMPv2MessageFormats-5.htm

So I think it is still a Net-SNMP configuration issue and you can post to Net-SNMP mail list or check out the archive,

http://www.net-snmp.org/support/contacts.html

Lex Li

http://sharpsnmplib.codeplex.com

查看更多
Lonely孤独者°
6楼-- · 2019-06-22 00:33

noAccess (as opposed to notWritable) could be caused by your VACM view configuration in snmpd.conf. Look to the com2sec, group, view, and access directives. Respectively, these map a community string and source address/subnet to a security name; add a security name as a member of a VACM group; define an OID subtree as a named view; and finally indicate the access level for a given set of those other parameters along with security model and security level. If gets return noError but sets return noAccess, chances are good that one of these directives has configured your community string or your IP address for read-only access for what would otherwise be a read-write variable.

查看更多
登录 后发表回答