Configure SNMP in Linux [RHEL7/RHEL8/CentOS]
Configure SNMP in Linux [RHEL7/RHEL8/CentOS]
Packages for required for SNMP
-------------------------------------------
net-snmp.x86_64
net-snmp-agent-libs.x86_64
net-snmp-libs.x86_64
net-snmp-utils.x86_64
---------------------------------------------
Check if all required packages installed, if not installed install as below:
# yum list *snmp*
Available packages
net-snmp.x86_64 @rhel-7-server-rpms
net-snmp-agent-libs.x86_64 @rhel-7-server-rpms
net-snmp-libs.x86_64 @rhel-7-server-rpms
net-snmp-utils.x86_64 @rhel-7-server-rpms
# yum install net-snmp.x86_64 net-snmp-agent-libs.x86_64 net-snmp-libs.x86_64 net-snmp-utils.x86_64
Configure snmp configuration file:
# vi /etc/snmp/snmpd.conf (Go to end of the file and check if snmp users are configured as below)
rouser <snmpuser>
rouser <snmpuser>
Use below command to add user in snmpd.conf file:
# net-snmp-create-v3-user -ro -A <password> -X <password> -a MD5 -x DES <user_name>
Will add the following line to /var/lib/net-snmp/snmpd.conf:
createUser <User_Name> MD5 "<Password>" DES <Password>en
Will add the following line to /etc/snmp/snmpd.conf:
rouser <User_Name>
# /bin/systemctl status snmpd.service
● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
Loaded: loaded (/usr/lib/systemd/system/snmpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
# /bin/systemctl start snmpd.service
# systemctl enable snmpd.service
# systemctl is-enabled snmpd.service
# systemctl list-unit-files --type service
Created symlink from /etc/systemd/system/multi-user.target.wants/snmpd.service to /usr/lib/systemd/system/snmpd.service.
# snmpwalk -v 3 -u <User_Name> -a MD5 -A <Password> -l authPriv -x DES -X <Password>en <IP_xxx.xxx.xxx.xxx>
# snmpwalk -v 3 -u <User_Name> -a MD5 -A <Password> -l authPriv -x DES -X <Password>en localhost
# /bin/systemctl restart snmpd.service
----------------------------------------------------------------------------------------------------
OR Configure manually as below:
----------------------------------------------------------------------------------------------------
Edit the snmp configuration file "snmpd.conf" :
# vi /var/lib/net-snmp/snmpd.conf (Change below line)
createUser admin MD5 "<Password>" <Password>
# vi /etc/snmp/snmpd.conf (At the end of file add as below)
rwuser <User_Name>
# service snmpd restart
# /bin/systemctl restart snmpd.service
# systemctl enable snmpd.service
Packages for required for SNMP
-------------------------------------------
net-snmp.x86_64
net-snmp-agent-libs.x86_64
net-snmp-libs.x86_64
net-snmp-utils.x86_64
---------------------------------------------
Check if all required packages installed, if not installed install as below:
# yum list *snmp*
Available packages
net-snmp.x86_64 @rhel-7-server-rpms
net-snmp-agent-libs.x86_64 @rhel-7-server-rpms
net-snmp-libs.x86_64 @rhel-7-server-rpms
net-snmp-utils.x86_64 @rhel-7-server-rpms
# yum install net-snmp.x86_64 net-snmp-agent-libs.x86_64 net-snmp-libs.x86_64 net-snmp-utils.x86_64
Configure snmp configuration file:
# vi /etc/snmp/snmpd.conf (Go to end of the file and check if snmp users are configured as below)
rouser <snmpuser>
rouser <snmpuser>
Use below command to add user in snmpd.conf file:
# net-snmp-create-v3-user -ro -A <password> -X <password> -a MD5 -x DES <user_name>
Will add the following line to /var/lib/net-snmp/snmpd.conf:
createUser <User_Name> MD5 "<Password>" DES <Password>en
Will add the following line to /etc/snmp/snmpd.conf:
rouser <User_Name>
# /bin/systemctl status snmpd.service
● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
Loaded: loaded (/usr/lib/systemd/system/snmpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
# /bin/systemctl start snmpd.service
# systemctl enable snmpd.service
# systemctl is-enabled snmpd.service
# systemctl list-unit-files --type service
Created symlink from /etc/systemd/system/multi-user.target.wants/snmpd.service to /usr/lib/systemd/system/snmpd.service.
# snmpwalk -v 3 -u <User_Name> -a MD5 -A <Password> -l authPriv -x DES -X <Password>en <IP_xxx.xxx.xxx.xxx>
# snmpwalk -v 3 -u <User_Name> -a MD5 -A <Password> -l authPriv -x DES -X <Password>en localhost
# /bin/systemctl restart snmpd.service
----------------------------------------------------------------------------------------------------
OR Configure manually as below:
----------------------------------------------------------------------------------------------------
Edit the snmp configuration file "snmpd.conf" :
# vi /var/lib/net-snmp/snmpd.conf (Change below line)
createUser admin MD5 "<Password>" <Password>
# vi /etc/snmp/snmpd.conf (At the end of file add as below)
rwuser <User_Name>
# service snmpd restart
# /bin/systemctl restart snmpd.service
# systemctl enable snmpd.service
Comments
Post a Comment