May 3, 2012
tom

SNMP (net-snmp) port configuration

Question

I’m setting up net-snmp on CentOS and I’m getting an issue setting up non-default port. Basically, if I set it up as 161 or port 32768 or greater, it works fine, but it doesn’t work for anything between 10000 and 32767. Any ideas what might be causing this? It’s particular to one server only, and it’s working fine on other similarly configured servers.

Here are the logs:

Here are the logs in /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

Asked by ashvagan

Answer

SELINUX strikes again.

Add a rule allowing it or disable selinux.

#getenforce#setenforce permissive

This might work as far as creating a new rule for selinux, but better to disable it if you don’t understand it, it will bite again.

# grep snmp /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp
Answered by foocorpluser

Related posts:

  1. NET-SNMP may be hitting a problem reporting partitions greater than 2TB
  2. Unable to start SNMP in RHEL5 64-bit
  3. snmp entry in log messages
  4. Snmp configuration giving me timeout, no response
  5. Does SELinux make Redhat more secure?

Leave a comment