CentOS / RHEL 7 : Install and Configure SNMPv3
CentOS / RHEL 7 : Install and Configure SNMPv3
Please find below Steps to configure SNMPv3.
1. Install the required packages
# yum install net-snmp net-snmp-utils net-snmp-devel -y
2. Create User
Turn off the agent the snmpd agent.
# systemctl stop snmpd
There are Three ways you can create the user.
1. CLI Mode
2. Interactive Mode
3. Manually
1. CLI mode
The syntax of "net-snmp-config –create-snmp3-user" is as below :
net-snmp-config --create-snmpv3-user [-ro] [-A authpass] [-X privpass] [-a MD5|SHA] [-x DES|AES] [username]
Default authentication method is MD5 and default encryption is DES if not explicitly specified.
# net-snmp-config --create-snmpv3-user -a MD5 -A testsnmp123 testsnmp
2. Interactive Mode
You can also use interactive mode to enter username and password as follows :
# net-snmp-create-v3-user
Enter a SNMPv3 user name to create:
testsnmp
Enter authentication pass-phrase:
testsnmp123
Enter encryption pass-phrase:
[press return to reuse the authentication pass-phrase]
adding the following line to /var/lib/net-snmp/snmpd.conf:
createUser testsnmp MD5 "testsnmp123" DES
adding the following line to /etc/snmp/snmpd.conf:
rwuser testsnmp
3. Manual
To manually add the user – add below line to the file /var/lib/net-snmp/snmpd.conf :
createUser testsnmp MD5 "testsnmp123" DES
and add below lines to the file /etc/snmp/snmpd.conf
rwuser testsnmp
The sample username is testsnmp and pass-phrase is testsnmp123.
3. Start the service
Configure the SNMP services to start on each reboot :
# systemctl enable snmpd
Start the snmpd service :
# systemctl start snmpd
4. Test the setup using snmpwalk command
# snmpwalk -v3 -u testsnmp -l authNoPriv -a MD5 -A testsnmp123 localhost
Here,
-v3 - specifies version
-u - specifies username
-l - specifies security level
-a - specifies Authentication Protocol
-A - specifies Pass-phrase
No comments