snmpd服务无法更改默认端口

问题描述

1
2
3
4
5
修改/etc/rc.d/init.d/snmpd的启动脚本
OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
修改为
OPTIONS="udp:9999 -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
service snmpd start 时无法启动该服务,终端没有报错提示

解决方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
tail -10 /var/log/messages
Aug 24 09:36:24 localhost snmpd[12063]: Error opening specified endpoint "udp:9999"
Aug 24 09:36:24 localhost snmpd[12063]: Server Exiting with code 1
Aug 24 09:36:24 localhost setroubleshoot: SELinux is preventing the snmpd (snmpd_t) from binding to port 9999\. For complete SELinux messages. run sealert -l ec7e5602-a40f-4831-97d0-ca9e84618549
so,暂且不考虑selinux,命令关掉selinux
setenforce 0
sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: disabled
Policy version: 21
Policy from config file: targeted
坚持原创分享,您的支持将鼓励我继续创作