The net-snmp package is available in the base repositories after enabling Subscription Management repositories.
- First we need to install the package containing the
snmpdservice:# dnf install net-snmp - To set the service to automatic start on boot, we use
systemctl:# systemctl enable snmpd - Let’s start the service:
# systemctl start snmpd - And verify it’s running state:
# systemctl status snmpd -l snmpd.service - Simple Network Management Protocol (SNMP) Daemon. Loaded: loaded (/usr/lib/systemd/system/snmpd.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2019-01-02 19:29:35 CET; 25min ago Main PID: 3217 (snmpd) Tasks: 1 (limit: 12544) Memory: 8.4M CGroup: /system.slice/snmpd.service 3217 /usr/sbin/snmpd -LS0-6d -f - To test it, we’ll need the
snmpwalkutility:# dnf install net-snmp-utils - To test it from the command line, we’ll query the default
publiccommunity („rhel8lab“ in the answer is the hostname of the lab machine):$ snmpwalk -v 2c -c public -O e 127.0.0.1 SNMPv2-MIB::sysDescr.0 = STRING: Linux rhel8lab 4.18.0-32.el8.x86_64 #1 SMP Sat Oct 27 19:26:37 UTC 2018 x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (174237) 0:29:02.37 SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf) SNMPv2-MIB::sysName.0 = STRING: rhel8lab [...] - For remote access, we need to add a new service to
firewalld. We create the text file/etc/firewalld/services/snmpd.xmlwith the following content:<?xml version="1.0" encoding="utf-8"?> <service> <short>SNMPD</short> <description>SNMP daemon</description> <port protocol="udp" port="161"/> </service>Open the firewall for the service:# firewall-cmd --zone=public --add-service snmpd --permanentAnd reload the firewall’s configuration:# firewall-cmd --reload - Now we can query the machine remotely the same way as we did on localhost:
$ snmpwalk -c public -v3c 192.168.0.91 <hostname-or-ip-address-of-the-machine>
Source: https://linuxconfig.org/how-to-install-snmp-on-redhat-8

