The purpose of this document is guide you how to install and setup snmp(snmpwalk) on CentOS 6.
OS: CentOs 5.3 or later
$ yum install net-snmp net-snmp-devel net-snmp-utils
We need to create a read-only account(lampnode), also known as read-only community:
$service snmpd stop $vim /etc/snmp/snmpd.conf
Add the following line to the end of this file:
rocommunity lampnode 192.168.0.16 rocommunity lampnode 192.168.0.17
The version 3 of SNMP (SNMP v3) is used to provide a secured environment in managing the systems and networks. The SNMPv3 Agent supports the following set of security levels as defined in the USM MIB (RFC 2574) :
By default, the SNMPv3 Agent provides support for three level of users, namely:
We will create a account(snmpuser, pass), and the password encryption method is MD5.
$service snmpd stop $net-snmp-config --create-snmpv3-user -ro -A pass -a MD5 snmpuser
NOTE: Before you use net-snmp-config, you should stop SNMP service. After adding the new user entry to the Tables, The v3 agent can now be accessed by the new user.
Disable SNMP v1 and SNMP v2c:commented out com2sec and group, in e.g:
#com2sec notConfigUser default public #group notConfigGroup v1 notConfigUser #group notConfigGroup v2c notConfigUser
view systemview included .188.8.131.52.2.1.1 view systemview included .184.108.40.206.220.127.116.11.1 view all included .1 80
NOTE: 80 is a mask. The “mask” field is used to control the elements of the OID sub-tree that should be considered as relevant when determining the view in which an OID is in. Normally, the OID is included on whole, so you will need a mask with as many bits set as there are in the OID elements.
Change the line:
access notConfigGroup "" any noauth exact systemview none none
access notConfigGroup "" any noauth exact all none none
syslocation "Server -- Lampnode office" syscontact email@example.com
Then, you should start the SNMP, and configurate this service.
$service snmpd start $chkconfig snmpd on
iptables -A INPUT -i eth0 -p udp -s 192.168.0.3 --dport 161 -j ACCEPT
$snmpwalk -c lampnode -v 2c 127.0.0.1
User Name “snmpuser”, Security level “authNoPriv” with MD5 Auth protocol for localhost(127.0.0.1):
$snmpwalk -v 3 -u snmpuser -a MD5 -A "pass" -l authNoPriv 127.0.0.1
NOTE: Please refer to snmpwalk simple guide for further information.