Debian
1. Installation
$ sudo apt-get update
$ sudo apt-get install snmpd
2. Configuration
With a text editor of your choice.
Edit the file: /etc/snmp/snmpd.conf
Add the following line:rocommunity public
Note: The default Ubuntu “snmpd” configuration specifically denies almost everything functional with this configuration (limiting access to just enough information to tell that the machine is a Linux one):view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
rocommunity public default -V systemonly
This configuration locks the machine down, which may be “safe” if it is on an insecure network with little SNMP administration knowledge available. However, if you are willing to monitor the performance of your machine with external systems, comment on them and replace the access with a secure mechanism (either with SNMP v3 or a different community string).
Comment the line:#agentAddress udp:127.0.0.1:161
Uncomment the line:
agentAddress udp:161,udp6:[::1]:161
Restart the snmpd service:
$ /etc/init.d/snmpd restart
Ubuntu
1. Installation
$ sudo apt-get update
$ sudo apt-get install snmpd
2. Configuration
Edit the file: /etc/snmp/snmpd.conf
with a text editor of your choice.
Add the following line:rocommunity public
Note: The default Ubuntu “snmpd” configuration specifically denies almost everything functional with this configuration (limiting access to just enough information to tell that the machine is a Linux one):view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
rocommunity public default -V systemonly
This configuration locks the machine down, which may be “safe” if it is on an insecure network with little SNMP administration knowledge available. However, if you are willing to monitor the performance of your machine with external systems, comment on them and replace the access with a secure mechanism (either with SNMP v3 or a different community string).
Comment the line:#agentAddress udp:127.0.0.1:161
Uncomment the line: agentAddress udp:161,udp6:[::1]:161
Restart the snmpd service:
$ /etc/init.d/snmpd restart
3. Allow SNMP ports in the Firewall
Execute the following commands to allow necessary ports:
$ ufw allow 161/udp
$ ufw allow 162/udp
CentOS
1. Installation
$ yum update
$ yum install net-snmp
2. Configuration
Edit the file: /etc/snmp/snmpd.conf
Add the next line:rocommunity public
Replace the line below:view systemview included .1.3.6.1.2.1.25.1.1
With the following line:view systemview included .1.3.
Restart the snmpd service:
$ /etc/init.d/snmpd restart
3. Allow SNMP ports in the Firewall
Execute the following commands to allow necessary ports:
$ firewall-cmd --zone=public --add-port=161/udp --permanent
$ firewall-cmd --zone=public --add-port=162/udp --permanent
$ firewall-cmd --reload
FreeBSD
1. Fetch Ports collection and install Installation
$ portsnap fetch
$ portsnap extract
$ cd /usr/ports/net-mgmt/net-snmp
$ make install clean
2. Configuration
Copy the following configuration file:cp /usr/local/share/snmp/snmpd.conf.example /usr/local/etc/snmpd.conf
Add the next line:rocommunity public
Comment the line:#agentAddress udp:127.0.0.1:161
Uncomment the line:agentAddress udp:161,udp6:[::1]:161
3. Allow SNMP ports in the Firewall
Edit the /etc/rc.conf file and add the following lines:
snmpd_enable=”YES”
snmpd_conffile=”/usr/local/etc/snmpd.conf”
Uncomment the line:agentAddress udp:161,udp6:[::1]:161
4. Start the Service
$ service snmpd start
Edit the /etc/rc.conf
file and add the following lines:
Red Hat Enterprise Linux (RHEL)
1. Installation
yum install net-snmp
2. Configuration
Edit the file: /etc/snmp/snmpd.conf
Add the following lines:rocommunity public
agentAddress udp:161,udp6:[::1]:161
Start the snmpd service:systemctl enable snmpd && systemctl start snmpd
3. Allow SNMP ports in the Firewall
Execute the following commands to allow necessary ports:
firewall-cmd --zone=public --add-port=161/udp --permanent
firewall-cmd --zone=public --add-port=162/udp --permanent
firewall-cmd --reload
Edit the /etc/rc.conf file and add the following lines:
Mac OS- How to enable SNMP on Mac OS
1. Configuration
Edit the file: /etc/snmp/snmpd.conf
Add the following line:rocommunity public
Please comment on the post if you find any errors or code needing updating.