Today we will look SNMP in Linux operating systems. Simple network management protocol named SNMP is designed for getting info and setting configuration in its entities. These entities may be a switch, router, pc, cabinet, printer, etc. Snmp was very popular in the 2000s. Today it is popular too but used for information gathering.

What Is SNMP?

SNMP is a standard which is mainly created to manage and monitor the network and network-connected devices. But during time the monitoring functionalities became popular and management functionalities are not used. SNMP has an index database named Management Information Base (MIB) used for data classification. Vendors generally publish their MIBs. For example, the Cisco MIB can be found http://www.cisco.com/public/sw-center/netmgmt/cmtk/mibs.shtml . The system that gathers SNMP info generally named Network management station. The systems that provide info or apply settings about yourself named Managed device. An agent is a tool that runs on a Managed Device and responsible for SNMP. SNMP works with UDP, ip, TCP, UNIX, udp6, tcp6

Install SNMP Packages

Fedora, CentOS, RedHat

In rpm-based distributions like Fedora, CentOS, Red Hat we will install the packages named net-snmp-utils and net-snmp like below.

$ sudo yum install net-snmp-utils net-snmp

Ubuntu, Debian, Mint, Kali

Firstly we install SNMP daemon, library, and tool with this command in fedora. Also, we can install it Debian based distributions like Ubuntu from official repositories.

$ sudo apt install snmpd

Start SNMP Service

After installing check the status of SNMP service named snmpd. As shown it is not started so we start it and check again the status

$ sudo systemctl start snmpd

Check SNMP Service

We can check the SNMP daemon or service status with the following command.

$ sudo systemctl status snmpd

SNMP Configuration File

SNMP daemon configuration file is stored under /etc/snmp with the name snmpd.conf .

$ sudo nano /etc/snmp/snmpd.conf

Change Public Community String

We will change the public community string with ismailbaydan in this line.

com2sec notConfigUser default ismailbaydan

Restart SNMP Service and Reload Configuration

After changing the SNMP configuration we have to reload the SNMP service to take effect new configuration. We will restart the snmpd daemon with the following command.

$ sudo systemctl restart snmpd

Get and Display SNMP Attributes/Values with snmpwalk

Here we run snmpwalk for system OUID with new password and SNMP community version 2. So we get all value in the system OUID and in its sub-branches.

$ snmpwalk -v2c -c ismailbaydan localhost system

How To Install and Use SNMP On Linux Tutorial with Examples? Infographic