• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Install and Configure SNMP in CentOS

{{postValue.id}}

To Install and Configure SNMP in CentOS

SNMP stands for Simple Network Management Protocol. It is an internet standard protocol that can retrieve the operational statistics of the routers and firewalls remotely. This article explains the installation and configuration process of the SNMP in CentOS.


Installation of SNMP

Utilize the ' yum' command to install SNMP packages.

[root@linuxhelp ~]# yum -y install net-snmp net-snmp-utils
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * extras: mirror.fibergrid.in
 * updates: mirror.fibergrid.in
Resolving Dependencies
-->  Running transaction check
--->  Package net-snmp.x86_64 1:5.7.2-24.el7_2.1 will be installed
-->  Processing Dependency: net-snmp-libs = 1:5.7.2-24.el7_2.1 for package: 1:net-snmp-5.7.2-24.el7_2.1.x86_64
-->  Processing Dependency: net-snmp-agent-libs = 1:5.7.2-24.el7_2.1 for package: 1:net-snmp-5.7.2-24.el7_2.1.x86_64
-->  Processing Dependency: libnetsnmptrapd.so.31()(64bit) for package: 1:net-snmp-5.7.2-24.el7_2.1.x86_64
-->  Processing Dependency: libnetsnmpmibs.so.31()(64bit) for package: 1:net-snmp-5.7.2-24.el7_2.1.x86_64
.
.
Installed:
  net-snmp.x86_64 1:5.7.2-24.el7_2.1                                                           

Dependency Installed:
  net-snmp-agent-libs.x86_64 1:5.7.2-24.el7_2.1                                                

Updated:
  net-snmp-utils.x86_64 1:5.7.2-24.el7_2.1                                                     

Dependency Updated:
  net-snmp-libs.x86_64 1:5.7.2-24.el7_2.1                                                      

Complete!

Once the SNMP packages is installed, add the basic configuration for SNMP.

[root@linuxhelp ~]# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig

Move the SNMP configuration to an alternate location, /etc/snmp/snmpd.conf.orig.

Now its time to create a new file and add the following lines as shown below,

[root@linuxhelp ~]# vim /etc/snmp/snmpd.conf

# Map ' idv90we3rnov90wer'  community to the ' ConfigUser' 
# Map ' 209ijvfwer0df92jd'  community to the ' AllUser' 
#       sec.name        source          community
com2sec ConfigUser      default         idv90we3rnov90wer
com2sec AllUser         default         209ijvfwer0df92jd
# Map ' ConfigUser'  to ' ConfigGroup'  for SNMP Version 2c
# Map ' AllUser'  to ' AllGroup'  for SNMP Version 2c
#                       sec.model       sec.name
group   ConfigGroup     v2c             ConfigUser
group   AllGroup        v2c             AllUser
# Define ' SystemView' , which includes everything under .1.3.6.1.2.1.1 (or .1.3.6.1.2.1.25.1)
# Define ' AllView' , which includes everything under .1
#                       incl/excl       subtree
view    SystemView      included        .1.3.6.1.2.1.1
view    SystemView      included        .1.3.6.1.2.1.25.1.1
view    AllView         included        .1
# Give ' ConfigGroup'  read access to objects in the view ' SystemView' 
# Give ' AllGroup'  read access to objects in the view ' AllView' 
#                       context model   level   prefix  read            write   notify
access  ConfigGroup     " "       any     noauth  exact   SystemView      none    none
access  AllGroup        " "       any     noauth  exact   AllView         none    none

Save and exit the file.

Restart the SNMP to take effect.

[root@linuxhelp ~]# service snmpd restart
Redirecting to /bin/systemctl restart  snmpd.service

Configure SNMP to start when the server boots:

[root@linuxhelp ~]# chkconfig snmpd on
Note: Forwarding request to ' systemctl enable snmpd.service' .
ln -s ' /usr/lib/systemd/system/snmpd.service'  ' /etc/systemd/system/multi-user.target.wants/snmpd.service' 

Try out the following two commands to test the SNMP configuration file.

[root@linuxhelp ~]# snmpwalk -v 2c -c idv90we3rnov90wer -O e 127.0.0.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux linuxhelp 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (19818) 0:03:18.18
SNMPv2-MIB::sysContact.0 = STRING: root@localhost
SNMPv2-MIB::sysName.0 = STRING: linuxhelp
SNMPv2-MIB::sysLocation.0 = STRING: Unknown
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (5) 0:00:00.05
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
.
.
.
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (5) 0:00:00.05
SNMPv2-MIB::sysORUpTime.10 = Timeticks: (5) 0:00:00.05
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (178268) 0:29:42.68
HOST-RESOURCES-MIB::hrSystemUptime.0 = No more variables left in this MIB View (It is past the end of the MIB tree)
[root@linuxhelp ~]# snmpwalk -v 2c -c 209ijvfwer0df92jd -O e 127.0.0.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux linuxhelp 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (25414) 0:04:14.14
SNMPv2-MIB::sysContact.0 = STRING: root@localhost
SNMPv2-MIB::sysName.0 = STRING: linuxhelp
SNMPv2-MIB::sysLocation.0 = STRING: Unknown
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (5) 0:00:00.05
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
.
.
.
SCTP-MIB::sctpRtoInitial.0 = Gauge32: 0 milliseconds
SCTP-MIB::sctpMaxAssocs.0 = INTEGER: 0
SCTP-MIB::sctpValCookieLife.0 = Gauge32: 0 milliseconds
SCTP-MIB::sctpMaxInitRetr.0 = Gauge32: 0

The result for your first command is about 33 lines and contain some basic system information. But the second command will display the information about the system and likely be thousands of lines.

Tags:
owen
Author: 

Comments ( 1 )

davshakaryan
Thanks
Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Need to configure SNMP from the host, not from PFsense?

A

For generating SNMP from the host
You need a firewall rule on WAN that passes the traffic to the inside address and port.
That is generated automatically by default.

Q

Have you tried to run ie 'tcpdump' with appropriate options on both server and client to see what happens when the SNMP-request is run?

A

SNMP is UDP (sessionless) ==> is a connection always possible and given during the whole request.

Q

How to make MIB file of SNMP protocol in linux?

A

You can download default MIBs from websites and upload them in Linux for SNMP Protocols.

Q

How do I remove a MIB from the agent?

A

Follow these steps mentioned below to remove MIB
re-run 'configure' to exclude the given MIB module(s) from the build configuration, then recompile and reinstall:



# ./configure --with-out-mib-modules=path/to/unwanted

# make

# make install

Q

What protocols are supported for SNMP?

A

SNMP supports all three current versions of SNMP (v1, v2c, and v3), over both UDP and TCP transports.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ganesh Konka ?
Zentya 6.1 http proxy configuration

please send link for creating zentyal 6.1 for http proxy and firewall as gateway.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.