Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Install SNMP on UNIX – *BSD – GNU/Linux

Leer en espanol
Install SNMP on UNIX – *BSD – GNU/Linux

Table of contents

He Simple Network Management Protocol either SNMP (of the English Simple Network Management Protocol) is a protocol of the application layer which facilitates the exchange of management information between network devices. It allows administrators to monitor network performance, find and resolve network problems, and plan network growth.

The most commonly used SNMP versions are SNMP version 1 (SNMPv1) and SNMP version 2 (SNMPv2).

SNMP in its latest version (SNMPv3) has significant changes compared to its predecessors, especially in security aspects, however it has not been widely accepted in the industry.

Debian or similar 

CODE
Bash
 apt-get install snmp snmpd

Configuration file: /etc/snmp/snmpd.conf

We add it so that it starts automatically

CODE
sql
update-rc.d snmpd defaults

Red-Hat o similares

BASH
Bash
yum -y install net-snmp net-snmp-utils

We add it so that it starts automatically

CODE
text
chkconfig snmpd on

Configuration file: /etc/snmp/snmpd.conf

Suse or similar 

CODE
text
 yast -i net-snmp

Configuration file: /etc/snmp/snmpd.conf

We add it so that it starts automatically

CODE
text
chkconfig snmpd on

Slackware

CODE
text
wget http://ftp.lip6.fr/pub/linux/distributions/slackware/slackware-13.1/source/n/net-snmp/net-snmp-5.5.tar.xz
CODE
text
installpkg net-snmp-5.5.tar.xz

Or also through slip-get

CODE
text
slapt-get --install net-snmp

ArchLinux

CODE
text
pacman -S net-snmp

BSD

CODE
text
cd /usr/ports/net-mgmt/net-snmp
make
make install
make clean

We add it so that it starts automatically

CODE
text
vi  /etc/rc.conf

And we add the following:

CODE
text
 snmpd_enable="YES"
snmpd_conffile="/usr/local/etc/snmpd.conf"

Configuration file: /usr/local/etc/snmpd.conf

We copy the template

CODE
Bash
cp /usr/local/share/snmp/snmpd.conf.example /usr/local/etc/snmpd.conf

Install on Solaris

CODE
text
./configure --with-mib-modules="ucd-snmp/lmSensors ucd-snmp/diskio \
      smux mibII/mta_sendmail" --with-cc=gcc
 We compile and install
CODE
text
Make && make install

Configuration file: /etc/sma/snmp/snmpd.conf

We copy the configuration template

CODE
text
/etc/sma/snmp/snmpd.conf.dist  /etc/sma/snmp/snmpd.conf

From Source Code

We download net-snmp

BASH
Bash
wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.1.1/net-snmp-5.6.1.1.tar.gz

We decompress

CODE
Bash
tar xvf net-snmp-5.6.1.1.tar.gz

We access the folder

We configure…

CODE
Bash
./configure --with-default-snmp-version="3" --with-sys-contact="rokitoh@red-orbita.com" --with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"

After a while something like this will appear

CODE
text
---------------------------------------------------------
Net-SNMP configuration summary:
---------------------------------------------------------

SNMP Versions Supported: 1 2c 3
Building for: linux
Net-SNMP Version: 5.6.1.1
Network transport support: Callback Unix Alias TCP UDP IPv4Base SocketBase TCPBase UDPIPv4Base UDPBase
SNMPv3 Security Modules: usm
Agent MIB code: default_modules => snmpv3mibs mibII ucd_snmp notification notification-log-mib target agent_mibs agentx disman/event disman/schedule utilities host
MYSQL Trap Logging: unavailable
Embedded Perl support: disabled
SNMP Perl modules: building -- not embeddable
SNMP Python modules: disabled
Crypto support from: internal
Authentication support: MD5 SHA1
Encryption support: DES AES

---------------------------------------------------------

We compile and install

CODE
text
Make && make install

More information

http://net-snmp.sourceforge.net/docs/readmefiles.html

We can leave the template that comes by default to configure rocommunity and the File System. I leave a configuration here.

CODE
Bash
com2sec paranoid default public
group MyROSystem v1 paranoid
group MyROSystem v2c paranoid
group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite
view all included .1
view system included .iso.org.dod.internet.mgmt.mib-2.system
access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmpd.local.conf)
rocommunity redorbita
#Aqui incluiremos los discos del servidor, para verlos: df -h
disk /
disk /home
disk /var
disk /usr

Greetings, rokitoh!!

Comments