Run the command below to effect this change. This involves modifying snmpd start up script. echo -e "# SNMP version 2c community\nrocommunity 192.168.43.101" > /etc/snmp/nfĬonfigure snmpd to listens for incoming SNMP requests on UDP port 161 on loopback and other interfaces. Set the community string and allow access from the Nagios server. ufw allow from 192.168.43.101 to any port 161 proto udp If firewall is running, allow connection from the Nagios server.
If you can check, SNMP is now listening on two interfaces netstat -nlpu|grep snmp Note that for any changes to the configuration file to take effect, force the snmpd service to re-read the configuration by running the following command: systemctl reload snmpd # Listen for connections on all interfaces (both IPv4 *and* IPv6) agentAddress udp:127.0.0.1:161,udp:192.168.43.154:161.Īlso, configure it to allow the monitoring server (Nagios server in my case, with IP, 192.168.43.101) only to connect using the community string ( ). By default, SNMP agent on is set to allow connections originating from the localhost only. To configure SNMP v2c On Ubuntu 18.04 proceed as follows Įdit the snmpd configuration file and configure it to listen on both a localhost and an interface IP. Where directive can be rocommunity (provides read-only access) or rwcommunity (provides read-write access), OID is the optional SNMP tree to provide access to. This directive should be set in the format directive community ]
The source address can be IP of the Nagios Server (SNMP server).
Configuring SNMP Version 2c CommunityĪs stated above, SNMP v2 provides access using a permission directive, a community string and the source Address. Both version 1 and 2c provides authentication using community string, a shared secret between the agent and the client that is passed in clear text over the network while version 3 supports user authentication and message encryption using a variety of protocols and is thus a bit more secure. SNMP supports three versions of SNMP protocol version 1, 2c and 3. cp /etc/snmp/nf /etc/snmp/ Configuring Authentication As a result, make a copy of the original file before you can proceed. The file is higly commented and thus, we will only make a few changes. The default configuration file for SNMP is /etc/snmp/nf. Once the installation is done, proceed to configure SNMP as follows.
#CENTOS SNMP TRAP RECEIVER INSTALL#
Apt install snmpd snmp libsnmp-dev Configure SNMP on Ubuntu 18.04 and CentOS 7