我用net-snmp 5.5 装在win7上,配置好V3 后,用snmp4j写了一个manager 端跟据Oid去取系统时间,
附代码:
UserTarget userTarget = new UserTarget();
userTarget.setVersion(SnmpConstants.version3);
userTarget.setSecurityLevel(SecurityLevel.AUTH_PRIV);
userTarget.setSecurityName(new OctetString(securityName));
当SecurityLevel.AUTH_PRIV 设置成这样时取数据不成功,报错为
1.3.6.1.6.3.15.1.1.6.0 查资料后得出是错误是返回值无法解析。
当SecurityLevel设置成AUTH_NOPRIV或NOAUTH_NOPRIV 能正常取到数据。
这个地方就没搞明白了,多次查资料都没有解决望那位高人指点一下net-snmp 要怎样配置。
附:net-snmp 配置文件
# sec.name source community
com2sec local localhost public
com2sec mynetwork 192.168.1.102 public
com2sec enocsnmpv3 default public
####
# Second, map the security names into group names:
# sec.model sec.name
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
group MyROGroup usm enocsnmpv3
####
# incl/excl subtree mask
view all included .1
# context sec.model sec.level match read write notif
access MyROGroup "" usm noauth exact all all none
access MyROGroup "" usm auth exact all all none
access MyROGroup "" usm priv exact all all none
# -----------------------------------------
syslocation Right here, right now.
syscontact Me <me@somewhere.org>
#createUser enocsnmpv3 MD5 enocsnmpv3pw DES enocsnmpv3pk
rwuser enocsnmpv3 auth