Enabling SNMP v3 on CentOS 8

Switching my build from Debian 10 to CentOS 8 due to Clevis’ bug in Debian. Since enabling SNMP v3 on CentOS is a bit different than Debian based OS, I thought I would post how I got mine configured.

To install SNMP on a CentOS 8 system

dnf install -y net-snmp net-snmp-libs net-snmp-utils

After installing the SNMP, the service should remain disabled and not running. However, just to make sure, before create an SNMP v3 user, make sure to stop the snmpd.service if it is running.

systemctl stop snmpd.service

To create an SNMP user, we need to specify some parameters via the command net-snmp-create-v3-user.

  • AuthPassword with your own auth password
  • EncryptionPassword with your own encryption password
  • AuthAlgorithm you have two options either MD5 or SHA
  • CrytoAlgorithm you have two options either DES or AES
  • AuthUserName with your own auth user name
net-snmp-create-v3-user -ro -A AuthPassword -X EncryptionPassword -a AuthAlgorithm -x CrytoAlgorithm AuthUserName

This is optional. Edit the file /etc/snmp/snmpd.conf and update the sysLocation (line 161) and syscontact (line 162) lines under the System contact information block.

162 syslocation Office
163 syscontact networkshinobi <[email protected]>

This is optional. To configure snmpd to listen from a specific interface, it requires modifying the /var/lib/systemd/system/snmpd.service. At the end of line #9, add the udp :<interface-ip-addr>:161. For multiple interfaces, just add a space after the previous interface.

# Original
  1 [Unit]
  2 Description=Simple Network Management Protocol (SNMP) Daemon.
  3 After=syslog.target network.target
  4 
  5 [Service]
  6 Type=notify
  7 Environment=OPTIONS="-LS0-6d"
  8 EnvironmentFile=-/etc/sysconfig/snmpd
  9 ExecStart=/usr/sbin/snmpd $OPTIONS -f
 10 ExecReload=/bin/kill -HUP $MAINPID
 11 
 12 [Install]
 13 WantedBy=multi-user.target

# Modified version
... omitted for brevity

  9 ExecStart=/usr/sbin/snmpd $OPTIONS -f udp:192.168.0.7:161

... omitted for brevity

Once done, start and enable the snmpd.service.

systemctl enable --now snmpd.service

That is the basics of enabling SNMP v3 on CentOS 8. Hope you’ll find this useful.

Cheers!

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x