【问题标题】:SNMPd opens "random" UDP port besides 161 and 162 to the outsideSNMPd 向外部打开除 161 和 162 之外的“随机”UDP 端口
【发布时间】:2020-03-25 22:52:55
【问题描述】:

我想使用 snmp 来监控我的 localhost,并已在 Ubuntu 18.03 上使用apt install snmp 安装了相应的软件包。在没有更改默认配置的情况下,我使用systemctl start snmpd 启动了守护进程。启动守护进程后,lsof -i -n | grep snmpd 的输出如下:

snmpd     14668     Debian-snmp   12u  IPv4 13252990      0t0  UDP 127.0.0.1:snmp 
snmpd     14668     Debian-snmp   13u  IPv4 13252988      0t0  UDP *:41898 

我想知道输出的第二行,因为端口已向外部开放。重新启动守护程序会将打开的端口更改为另一个(随机?)高端口号。我一直在查找这种行为几个小时,但找不到任何解释。

谁能向我解释这里发生了什么或如何禁用/删除开放端口?


配置

AgentAdress 配置如下:

# /etc/snmp/snmpd.conf

# Listen for connections from the local system only
agentAddress  udp:127.0.0.1:161

守护程序已启动,具有以下选项:

# /etc/default/snmp

# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'

ps aux | grep snmpd的输出

/usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux mteTrigger mteTriggerConf -f

【问题讨论】:

    标签: snmp snmpd


    【解决方案1】:

    所以,如果有人遇到同样的问题:UDP 端口已被 snmp-trap 打开。为了避免这种行为,我不得不在 snmpd.conf 中注释掉以下行:

    /etc/snmp/snmpd.conf
    
    #  ACTIVE MONITORING
                                        #   send SNMPv1  traps
    # !comment this line out!
    # trapsink     localhost public
    

    阅读此链接了解更多信息:https://sourceforge.net/p/net-snmp/mailman/message/29219475/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-27
      • 2019-02-09
      • 1970-01-01
      • 2021-01-29
      • 2014-01-09
      相关资源
      最近更新 更多