Linux serverNETWORK ADMINISTRATIONS

Quick setup of SNMP v3 USM access on CentOS/RHEL 7 Linux – net-snmp



The video gives basic overview how to setup SNMP v3 USM access including saved configuration in snmp.conf.

There are commands used in the video:

1) Where are we?
cat /etc/centos-release

2) Install net-snmp RPMs
yum install net-snmp net-snmp-libs net-snmp-utils
net-snmp-agent-libs

3) Open /etc/snmp/snmpd.conf
vim /etc/snmp/snmpd.conf

4) Add SNMP v3 users.
In this example ‘roadmin’ for read-only access and
‘rwadmin’ for read-write access. Let’s use SHA
as password hash algorithm and AES for session
encryption:

createUser roadmin SHA admin123 AES
createUser rwadmin SHA admin321 AES
rouser roadmin authpriv system
rwuser rwadmin authpriv system

5) Enable snmpd and start it
systemctl enable snmpd
systemctl start snmpd

6) For test use following SNMP v3 request
snmpget -v 3 -u roadmin -l authPriv -a SHA -x AES
-A admin123 -X admin123 localhost sysUpTime.0

It works. Perfect!

7) Now let’s setup config in our home directory so we
don’t have to enter passwords in plaintext
on the command line

Create .snmp directory in our home
mkdir ~/.snmp
touch ~/.snmp/snmp.conf

8) Make sure the configuration is only available to this user
chmod -R 600 ~/.snmp

9) Open ~/.snmp/snmp.conf
vim ~/.snmp/snmp.conf

10) Enter the connection settings

defVersion 3
defSecurityName roadmin
defSecurityLevel authPriv
defAuthType SHA
defPrivType AES
defAuthPassphrase admin123
defPrivPassphrase admin123

11) Let’s test. This time authentication settings are
taken from the snmp.conf in our home directory
snmpwalk -v3 localhost sysUpTime.0

source
centos 7

Leave a Reply

Your email address will not be published. Required fields are marked *