Saturday, July 4, 2009

HOWTO Install SNMP and Test SNMPv1 (UBUNTU)

HOWTO Install SNMP and test SNMPv1(UBUNTU)

1.- Install UBUNTU (Versions: 9.04, 8.10, 8.04)

Burn an ISO CD from: (To run as LIVE CD, install in HDD or Virtual Machine)
(To install inside Windows as VirtualHDD with dual boot option)

2.- Verify the requirements

SSH client (Open SSH) (Linux-installed by default) - Secure remote access
VIM - Text Editor (optional)
wmunguiam@server:~$ sudo apt-get install vim openssh-server
[sudo] password for wmunguiam: YourOwnPasswordHere

3.- Install SNMP Server ("Yes" if asked for other packages installation)
wmunguiam@server:~$ sudo apt-get install snmpd
[sudo] password for wmunguiam: YourOwnPasswordHere
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
Se instalarán los siguientes paquetes NUEVOS:
0 actualizados, 1 se instalarán, 0 para eliminar y 17 no actualizados.
Necesito descargar 74.1kB de archivos.
Se utilizarán 385kB de espacio de disco adicional después de desempaquetar.
Des:1 hardy-updates/main snmpd 5.4.1~dfsg-4ubuntu4.2 [74.1kB]
Descargados 74.1kB en 2s (33.9kB/s)
Preconfigurando paquetes ...
Seleccionando el paquete snmpd previamente no seleccionado.
(Leyendo la base de datos ...
216548 ficheros y directorios instalados actualmente.)
Desempaquetando snmpd (de .../snmpd_5.4.1~dfsg-4ubuntu4.2_i386.deb) ...
Configurando snmpd (5.4.1~dfsg-4ubuntu4.2) ...
Starting network management services: snmpd.

4.- Install SNMP client ("Yes" if asked for other packages installation)
wmunguiam@server:~$ sudo apt-get install snmp

5.- Configure SERVER (Allow access from other LAN devices)

wmunguiam@server:~$ sudo vim /etc/default/snmpd

Comment the following line: (pay attention with "#" character)
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/'

and add this other line:
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/'

Remember: (Some VIM Editor commmands)
To edit press: i
To exit edition press: ESC
To write changes: :w
To quit form editor without save changes: :q!
To quit form editor and save changes: :wq

Review edited file:
wmunguiam@server:~$ more /etc/default/snmpd

The whole file:
# This file controls the activity of snmpd and snmptrapd

# MIB directories. /usr/share/snmp/mibs is the default, but
# including it here avoids some strange problems.
export MIBDIRS=/usr/share/snmp/mibs

# snmpd control (yes means start daemon).

# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/'

# snmptrapd control (yes means start daemon). As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run. See snmpd.conf(5) for how to do this.

# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/'

# create symlink on Debian legacy location to official RFC path

6.- Backup "snmpd.conf"

wmunguiam@server:~$ sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf-backup

7.- Edit "snmpd.conf" file as desired (SNMPv1, SNMPv2c or SNMPv3)

Example for SNMPv1
wmunguiam@server:~$ sudo vim /etc/snmp/snmpd.conf

Add the lines and save:

rocommunity mycommunityro default system
rwcommunity mycommunitywr default system
syslocation MyLAB
syscontact Engineer_Lab1

8.- Restar SNMP service
wmunguiam@server:~$ sudo /etc/init.d/snmpd restart
Restarting network management services:.

9.- Test configuration

wmunguiam@server:~$ snmpwalk -Os -c mycommunityro -v 1 localhost system
sysDescr.0 = STRING: Linux server 2.6.24-23-generic #1 SMP Wed Apr 1 21:47:28 UTC 2009 i686
sysObjectID.0 = OID: netSnmpAgentOIDs.10
sysUpTimeInstance = Timeticks: (700) 0:00:07.00
sysContact.0 = STRING:
sysName.0 = STRING: server
sysLocation.0 = STRING:
sysORLastChange.0 = Timeticks: (0) 0:00:00.00
sysORID.1 = OID: snmpFrameworkMIBCompliance
sysORID.2 = OID: snmpMPDCompliance
sysORID.3 = OID: usmMIBCompliance
sysORID.4 = OID: snmpMIB
sysORID.5 = OID: tcpMIB
sysORID.6 = OID: ip
sysORID.7 = OID: udpMIB
sysORID.8 = OID: vacmBasicGroup
sysORDescr.1 = STRING: The SNMP Management Architecture MIB.
sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
sysORDescr.3 = STRING: The management information definitions for the SNMP User-based Security Model.
sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
sysORDescr.5 = STRING: The MIB module for managing TCP implementations
sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
sysORDescr.7 = STRING: The MIB module for managing UDP implementations
sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
sysORUpTime.1 = Timeticks: (0) 0:00:00.00
sysORUpTime.2 = Timeticks: (0) 0:00:00.00
sysORUpTime.3 = Timeticks: (0) 0:00:00.00
sysORUpTime.4 = Timeticks: (0) 0:00:00.00
sysORUpTime.5 = Timeticks: (0) 0:00:00.00
sysORUpTime.6 = Timeticks: (0) 0:00:00.00
sysORUpTime.7 = Timeticks: (0) 0:00:00.00
sysORUpTime.8 = Timeticks: (0) 0:00:00.00


  1. Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

  2. we have face issue

    system: Unknown Object Identifier (Sub-id not found: (top) -> system)