Linux-Networking

嘗試查詢 SNMP 伺服器時超時

  • July 25, 2017

我正在嘗試對 snmp 伺服器執行查詢,但總是收到超時錯誤。我正在使用 SLES 11 (OpenSUSE) 並且防火牆已禁用

我正在執行的查詢是:

> snmpwalk -mALL -v1 -ccomname localhost system 2 > /dev/null
Timeout: No Response from localhost

我試圖通過配置文件hosts.allow/etc/snmp/snmpd.conf. 這些文件如下:

hosts.allow

snmpd : ALL : ALLOW

snmpd.conf

syslocation Server Room
syscontact Sysadmin (root@localhost)

# These really aren't meant for production use.  They include all MIBS
# and can use considerable resources.  See snmpd.conf(5) for information
# on setting up groups and limiting MIBS.
rocommunity public 127.0.0.1
# rwcommunity mysecret 127.0.0.1

網路統計

此外,我測試了伺服器實際上正在監聽netstat

> sudo netstat -tualpn | grep snmp
tcp        0      0 127.0.0.1:199           0.0.0.0:*               LISTEN      20561/snmpd         
udp        0      0 0.0.0.0:161             0.0.0.0:*                           20561/snmpd

日誌文件

另外,我檢查了日誌文件:

NET-SNMP version 5.4.2.1
Connection from UDP: [127.0.0.1]:47705->[127.0.0.1]
Connection from UDP: [127.0.0.1]:47705->[127.0.0.1]
[...]
Connection from UDP: [127.0.0.1]:39362->[127.0.0.1]
Connection from UDP: [127.0.0.1]:39362->[127.0.0.1]
Connection from UDP: [127.0.0.1]:39362->[127.0.0.1]
Connection from UDP: [127.0.0.1]:39362->[127.0.0.1]

我觀察到,每次執行該snmpwalk語句時,都會在日誌中添加 6 個與上述類似的條目。

問題是社區名稱錯誤,應該publiccomname.

我執行 snmp 配置將社區名稱設置為comname,但它仍然是“公共的”。我不知道為什麼。

引用自:https://serverfault.com/questions/865002