我无法从我的设备本身设置甚至获取 SNMP 值,但我可以从远程位置。
这是我的 snmpd.conf 文件。如您所见,仅在本次测试中,我有两个社区我授予了完全访问权限。(之后我会将我的公共社区改为只读,别担心)
com2sec rw default public
com2sec rw localhost private
group public v1 rw
group public v2c rw
group public usm rw
group private v1 rw
group private v2c rw
group private usm rw
view all included .1
access public "" any noauth exact all all all
access private "" any noauth exact all all all
在这里,我可以从远程位置设置和获取我的 SNMP 值。
$ snmpget -v2c -c public x.x.x.x SNMPv2-MIB::sysName.0
SNMPv2-MIB::sysName.0 = STRING: default
$ snmpset -v2c -c public x.x.x.x SNMPv2-MIB::sysName.0 s "TEST_TEST"
SNMPv2-MIB::sysName.0 = STRING: TEST_TEST
$ snmpget -v2c -c public x.x.x.x SNMPv2-MIB::sysName.0
SNMPv2-MIB::sysName.0 = STRING: TEST_TEST
$
现在,当我从设备本身尝试时……这就是我得到的。我不能 snmpwalk 它或任何东西。为什么?
$ snmpget -v2c -c private localhost SNMPv2-MIB::sysName.0
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (TUNNEL-MIB): At line 0 in (none)
Cannot find module (IPV6-FLOW-LABEL-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
getaddrinfo: localhost Name or service not known
snmpget: Unknown host (localhost) (No such file or directory)
我希望能够从我的设备中更改一些值,以便我可以 snmpwalk 它并获取这些值。感谢所有帮助!