sudo apt-get install snmpd
Edit file /etc/default/snmpd and make sure those values are set:
SNMPDRUN=yes SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
If you want your server to listen on all interfaces, remove the 127.0.0.1 bit.
Edit /etc/snmp/snmpd.conf and change com2sec so that you have a private community
com2sec readonly default mycommunity
If you want a remote machine to be able to gather information for the community mycommunity, make sure you replace localhost by mynetwork, where mynetwork can be of the form: 1.1.1.1 or 1.1.0.0/16.
We are going to use the snmpwalk utility to verify that the server is working as wanted.
Here we want snmp to reply only to localhost for the community mycommunity.
From localhost
snmpwalk -Os -c mycommunity -v 1 localhost system
Should return a lot of output and:
snmpwalk -Os -c public -v 1 localhost system Timeout: No Response from localhost
If the second command returns result, it might be because you did not comment the line starting with com2sec.
If you have a firewall running, you need to open UDP port 161 to allow external connections
No comments:
Post a Comment