Skip to content

Configuring SNMP on Linux

Tutorial aimed at enabling a basic configuration of SNMP services on Linux operating systems.

While logged in as root, in the Linux terminal type:

Terminal window
yum install net-snmp

While logged in as root, in the Linux terminal type:

Terminal window
apt-get install snmpd

Generally, the snmpd.conf file is located at /etc/snmp/. Back up the original file:

Terminal window
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old

Edit the new file (example with vim: vim /etc/snmp/snmpd.conf) as the lines below:

Terminal window
rocommunity public
sysLocation “Localização deste servidor”
sysContact seu@email.com.br

In the terminal, type:

Terminal window
systemctl restart snmpd
systemctl enable snmpd

In the terminal, type:

Terminal window
service snmpd restart

Allow the SNMP service through the Linux firewall

Section titled “Allow the SNMP service through the Linux firewall”

If the Linux server or workstation you want to monitor has a firewall enabled, to access the SNMP service add the example below to the firewall rules of that device. If your distribution manages the firewall differently, open the incoming UDP/161 port.

Terminal window
firewall-cmd --permanent --zone=public --add-port=161/udp
systemctl restart firewalld