Install SNMP.
yum install net-snmp net-snmp-utils
Configure the SNMP V3 user by running the following command and then following the prompts it gives you.
net-snmp-create-v3-user
Example: The username is “snmpadmin” and the password is”r123456″
[root@localhost ~]# net-snmp-create-v3-user Enter a SNMPv3 user name to create: snmpadmin Enter authentication pass-phrase: r123456 Enter encryption pass-phrase: [press return to reuse the authentication pass-phrase] adding the following line to /var/lib/net-snmp/snmpd.conf: createUser snmpadmin MD5 "r123456" DES adding the following line to /etc/snmp/snmpd.conf: rwuser snmpadmin [root@localhost ~]#
Change the syslocation and syscontact in the /etc/snmp/snmpd.conf file.
vi /etc/snmp/snmpd.conf
Start snmpd service
service snmpd start
Configure snmp to start on system boot.
chkconfig snmpd on
Test and make sure snmp is working
replace “password” and “username” with the ones you setup when you created the SNMP V3 user.
snmpwalk -v3 -a MD5 -A password -x DES -X password -l authPriv -u privuser localhost
If you receive something like “snmpwalk: Timeout” then something is not working correctly. Check to make sure the service is started, and make sure that your firewall is not blocking SNMP.
If you are running a firewall, run the following commands to allow it through.
firewall-cmd --zone=public --add-port=161/udp --permanent semanage port -a -t snmp_port_t -p udp 161 firewall-cmd --reload
On iptables you should be able to do
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 161 -j ACCEPT
or add it to /etc/sysconfig/iptables and then restart iptables