Step # 3 : Make sure snmp server configured properly
Run the snmpwalk command to request for tree of information about network entity. In simple words, query the snmp server for your IP address (assigned to your eth0, eth1, lo interface by Linux):
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndexSample outputs:
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.0.3 = 2
If you see your IP address, proceed to step 4; else it is a time to configure snmp server as follows (by default RHEL and older Redhat v8/9 are not configured for snmp server for security reason):
Configure SNMP
(1) Edit the file /etc/snmp/snmpd.conf using a text editor such as vi, enter:# vi /etc/snmp/snmpd.conf
Change/Modify line(s) as follows:
Find the following Line:
com2sec notConfigUser default publicReplace with (make sure you replace 192.168.0.0/24 with your network/subnet) the following lines:
com2sec local localhost public com2sec mynetwork 192.168.0.0/24 public
Scroll down a bit and change :
Find Lines:
group notConfigGroup v1 notConfigUser group notConfigGroup v2c notConfigUser
Replace with:
group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local group MyROGroup v1 mynetwork group MyROGroup v2c mynetwork group MyROGroup usm mynetwork
Again scroll down a bit and locate the following line:
Find line:
view systemview included system
Replace with:
view all included .1 80
Again scroll down a bit and change the following line:
Find line:
access notConfigGroup "" any noauth exact systemview none none
Replace with:
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
Scroll down a bit and change the following lines:
Find lines:
syslocation Unknown (edit /etc/snmp/snmpd.conf) syscontact RootReplace with (make sure you supply appropriate values):(configure /etc/snmp/snmp.local.conf)
syslocation Linux (RH3_UP2), Home Linux Router.
syscontact YourNameHere <you@example.com>
For your convenient, here is my /etc/snmp/snmpd.conf file. Feel free to use this file. Make sure you make a backup of your existing file.
Start your snmp server and test it:
(a) Make sure when linux comes up snmpd always starts after the system reboot:
# chkconfig snmpd on
(b) Start the snmpd service:
# service snmpd start
(c) Finally, test your snmp server:
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex

