![net-snmp 将默认端口 161 更改为其他端口](https://linux22.com/image/666970/net-snmp%20%E5%B0%86%E9%BB%98%E8%AE%A4%E7%AB%AF%E5%8F%A3%20161%20%E6%9B%B4%E6%94%B9%E4%B8%BA%E5%85%B6%E4%BB%96%E7%AB%AF%E5%8F%A3.png)
端口 161/162 被 Java 软件使用,因此要求将 163 用于 net-snmp
[root@testSRV snmp]# netstat -apn | grep 162
udp 0 0 ::ffff:10.145.1.10:162 :::* 2827/java
[root@testSRV snmp]# netstat -apn | grep 161
udp 0 0 ::ffff:10.145.1.10:161 :::* 2827/java
[root@testSRV snmp]# cat /etc/snmp/snmpd.conf
com2sec notConfigUser default public
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
access notConfigGroup "" any noauth exact systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
sysContact Test, Inc.
sysName TestSystem
sysDescr TestSystem Test, Inc
rocommunity public
rwcommunity private
trapsink localhost public
trap2sink localhost public
agentaddress udp:127.0.0.1:163
猫/等/系统配置/ snmpd
# snmpd command line options
[root@testSRV snmp]#
[root@testSRV snmp]#
尝试启动 snmpd
[root@testSRV snmp]# /etc/init.d/snmpd restart
Stopping snmpd: [FAILED]
Starting snmpd: [FAILED]
在 /var/log/messages 上
Sep 17 15:55:12 testSRV snmpd[18911]: Error opening specified endpoint "udp:127.0.0.1:163"
Sep 17 15:55:12 testSRV snmpd[18911]: Server Exiting with code 1
如果我从 /etc/snmp/snmpd.conf 中删除行“agentaddress udp:127.0.0.1:163”并使用以下命令
[root@testSRV snmp]# snmpd -f -Lo udp:163 -C -c /etc/snmp/snmpd.conf
error on subcontainer 'ia_addr' insert (-1)
NET-SNMP version 5.5
error on subcontainer 'ia_addr' insert (-1)
error on subcontainer 'ia_addr' insert (-1)
error on subcontainer 'ia_addr' insert (-1)
SNMPD 启动了,但是控制台上出现了上面的信息。有没有办法将“snmpd -f -Lo udp:163 -C -c /etc/snmp/snmpd.conf”的参数用于 /etc/snmp/snmpd.conf?