CentOS7.9 snmp更改161端口
端口更改前:
命令:
netstat -antulp | grep 161
[root@logstash snmp]# netstat -antulp | grep 161
udp 0 0 0.0.0.0:161 0.0.0.0:* 12031/snmpd
[root@logstash snmp]#
端口更改时:
1.编辑/etc/snmp/snmpd.conf文件,找到配置文件中关于端口的行,通常是以下这样的形式:
agentAddress udp:161
将161改成你想要的端口号,例如185。如果此行不存在,就新增该行,并保存。
[root@logstash snmp]# cat /etc/snmp/snmpd.conf | grep -i agentAddress
agentAddress udp:161
[root@logstash snmp]#
2.重启snmpd服务
命令:
systemctl restart snmpd
[root@logstash snmp]# systemctl restart snmpd
[root@logstash snmp]# systemctl status snmpd
● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
Loaded: loaded (/usr/lib/systemd/system/snmpd.service; disabled; vendor preset: disabled)
Active: active (running