Today we will look SNMP in Linux operating systems. Simple network management protocol named SNMP is designed for getting info and setting configuration in it entities. These entities may be switch, router, PC, cabinet, printer etc. SNMP was very popular in 2000s. today it is popular too but used for information gathering. Especially monitoring which will be examined later is made today with snmp. Snmp has an index database which named Management Information Base (MIB) used for data classification. Vendors generally publish their MIBs. For example 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 provides info or apply settings about yourself named Managed device. Agent is a tool that runs on Managed Device and responsible for snmp.
Install SNMP Ubuntu, Debian, Mint
We can install SNMP service to the
deb based distributions like below. The package name is
$ sudo apt install snmpd snmp -y
Install SNMP Fedora, CentOS, RedHat
Firstly we install snmp daemon, library and tool with this command in Fedora, CentOS, RHEL .
$ sudo yum install net-snmp-utils.x86_64 net-snmp.x86_64
List Snmpd Service Status
After installing SNMP package we can check status of the service or daemon. We will use
systemctl command against service called
$ systemctl status snmpd
SNMP Service Configuration File snmpd.conf
SNMP service configuration file is located at
/etc/snmp. It is named
snmpd.conf . It holds all detailed information about the service like
sysLocation , public and private passwords. We can also create users and restrict the user and OIB access etc. In order to change this configuration we need
Configure For Remote Connection
Security is important aspect for todat IT environment. In order to make SNMP default installation the service only listen local connections via
localhost . Because default installation will have passwords like
private. A remote attacker can access to the snmp service. Before enabling remote access change
Find following line
change to listen all interfaces
Change sysContact and sysLocation
We can also change the contact and location information via
sysLocation attributes. We will find the in
snmpd.conf file and set whatever we want.
sysLocation InPoftut sysContact [email protected]
Restart SNMP Service For Reload New Configuration
We made some configuration. In order to make them effective we should reload configuration. Most pratical way to reload configuration is restarting the
snmpd service like below.
$ sudo systemctl restart snmpd
Test SNMP Service
We can test our new configuration and snmp service with one of snmp tool. In this example we will use
snmpwalk which will list all snmp data.
$ snmpwalk -v 2c -c public localhost
As we can see our new data like contact and location information is activated and listed accordingly.