我正在CentOS上设置net,并且遇到了设置非默认端口的问题。基本上,如果我将其设置为161个或端口32768或更高,它可以正常工作,但在10000到32767之间,它不起作用。
有什么原因吗?它只适用于一台服务器,并且在其他配置类似的服务器上运行良好。
下面是/var/log/messages中的日志:
May 3 11:15:27 oninfra01 snmpd[27709]: Error opening specified endpoint "5161"
May 3 11:15:27 oninfra01 kernel: type=1400 audit(1336058127.584:57070): avc: denied { name_bind } for pid=27709 comm="snmpd" src=5161 scontext=unconfined_u:system_r:snmpd_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=udp_socket
May 3 11:15:27 oninfra01 kernel: type=1400 audit(1336058127.584:57071): avc: denied { name_bind } for pid=27709 comm="snmpd" src=5161 scontext=unconfined_u:system_r:snmpd_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=udp_socket
May 3 11:15:27 oninfra01 snmpd[27709]: Server Exiting with code 1发布于 2012-05-03 15:20:15
SELINUX再次攻击。
添加允许它的规则或禁用selinux。
#getenforce
#setenforce permissive这可能会为selinux创建一个新规则,但是最好禁用它,如果您不理解它,它会再次咬人。
# grep snmp /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp发布于 2012-05-04 07:26:13
允许在SELinux中为snmp提供更多端口的一种方法是
semanage port -a -t snmp_port_t -p tcp 10000-32767
semanage port -a -t snmp_port_t -p udp 10000-32767(运行命令可能需要一段时间,这是正常的,因为SELinux编译它的规则集)
检查它是否正常:
semanage port -l | grep snmphttps://serverfault.com/questions/385712
复制相似问题