Ubuntu SNMP binding only to (localhost) – How to fix

Print Friendly, PDF & Email

By default, when you install snmpd (this was tested on Ubuntu 10.04, not sure about other Linux variants), the daemon is set to listen only on (localhost)

If you run chech the process, you can see this:

techedemic@demo:/etc/default$ ps awux | grep snmp
snmp     32753  0.3  2.0  47916  4948 ?        S    09:29   0:00 /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid
sintrex  32757  0.0  0.3   7624   904 pts/0    S+   09:29   0:00 grep --color=auto snmp

To allow access to any machine from outside (make sure your company security policies allow for this), you need to edit the /etc/default/snmpd file as follows:

(I use vim, you can obviously use any text editor you want)

Step 1

#open the file
sudo vim /etc/default/snmpd
#change the following line..
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
#to look like this..
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
#save and quit

Step 2

#restart snmpd daemon
sudo /etc/init.d/snmpd restart

You will now be able to do snmp queries from any machine that can reach your host.

Share and Enjoy !

0 0

Add a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.