wiki:librenms

Version 4 (modified by admin, 7 years ago) ( diff )

--

SNMP and LibreNMS

In the first part of this Hands-On you will install and learn some basic SNMP commands. Then you will Install LibreNMS and Configure the Network Management System

SNMP

Installing client (manager) tools

Start by installing the net-snmp tools:

$ sudo apt-get install snmp
$ sudo apt-get install snmp-mibs-downloader

The second of the two commands downloads the standard IETF and IANA SNMP MIBs which are not included by default.

Note: to find snmp-mibs-downloader, you must enable the “multiverse” source in your APT configuration. This has already been done for you in this workshop.

Now, edit the file /etc/snmp/snmp.conf:

$ sudo vi /etc/snmp/snmp.conf

Change this line:

mibs :

... so that it looks like:

# mibs :

(You are “commenting out” the empty mibs statement, which was telling the snmp* tools not to automatically load the mibs in the /usr/share/mibs/ directory)

Now, in your home directory make a .snmp directory with file snmp.conf inside it, make it readable only be you, and add the credentials to it:

$ cd
$ mkdir .snmp
$ chmod 700 .snmp/
$ vi .snmp/snmp.conf

Put the following contents in the file:

defVersion v2c
defCommunity NetManage

Creating this configuration file means you won't have to enter your snmp community everytime you use one of the SNMP utilities.

Configure SNMP on Your Router (Already done)

Note: If you are using a cisco router this is the way to enable snmp on the device. In this lab this part is already done.

Connect to your router:

rtrN> enable
Password: <>
rtrN# configure terminal			(conf t)

Now we need to add an Access Control List rule for SNMP access, turn on SNMP, assign a read-only SNMP community string as well as a SNMPv3 group and user and tell the router to maintain SNMP information across reboots. To do this we do:

rtrN(config)# access-list 99 permit 10.10.0.0 0.0.255.255
rtrN(config)# snmp-server community NetManage ro 99

Now let's exit and save this new configuration to the routers permanent config.

rtrN(config)# exit
rtrN# write memory					(wr mem)
rtrN# exit						(until you return to your pc)

Testing SNMP

To check that your SNMP installation works, run the snmpstatus command on each of the following devices

$ snmpstatus <ip_address>

Where is each of the following:

* LEARN Router:  192.248.1.1
* Lab Switch  :  

What happens if you try using the wrong community string (i.e. change NetManage to something else) using the options "-c NetWrong”?

SNMP Walk and OIDs

Now, you are going to use the snmpwalk command, part of the SNMP toolkit, to list the tables associated with the OIDs listed below, on each piece of equipment you tried above:

.1.3.6.1.2.1.2.2.1.2
.1.3.6.1.2.1.31.1.1.1.18
.1.3.6.1.4.1.9.9.13.1
.1.3.6.1.2.1.25.2.3.1
.1.3.6.1.2.1.25.4.2.1

You will try this with two forms of the snmpwalk command:

$ snmpwalk <ip_address> <oid>

and

$ snmpwalk -On <ip_address> <oid>

... where OID is one of the OIDs listed above: .1.3.6...

...where IP_ADDRESS can be your group's router...

Note: the -On option turns on numerical output, i.e.: no translation of the OID <-> MIB object takes place.

For these OIDs:

a) Do all the devices answer ? b) Do you notice anything important about the OID on the output ?

Configuration of snmpd on your PC

For this exercise your group needs to verify that the snmpd service is running and responding to queries for all machines in your group. First enable snmpd on your machine, then test if your machine is responding, then check each machine of your other group members.

Install the SNMP agent (daemon)

$ sudo apt-get install snmpd
$ sudo apt-get install libsnmp-dev

Configuration

We will make a backup of the distributed config, and then we will create our own:

$ cd /etc/snmp
$ sudo mv snmpd.conf snmpd.conf.dist
$ sudo vi snmpd.conf

Then, copy/paste the following (change pcX to your own pc number):

#  Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161

# For SNMPv2: Configure Read-Only community and restrict who can connect
rocommunity NetManage  10.10.0.0/16
rocommunity NetManage  127.0.0.1

# Information about this host
sysLocation    NSRC Network Management Workshop
sysContact     sysadm@pcX.ws.nsrc.org

# Which OSI layers are active in this host
# (Application + End-to-End layers)
sysServices    72

# Include proprietary dskTable MIB (in addition to hrStorageTable)
includeAllDisks  10%

Now save and exit from the editor.

Now we will add the same SNMPv3 user to your PC. We need to stop snmpd before adding the user, and restart it to read the above changes as well as the new user:

$ sudo service snmpd restart

Check that snmpd is working:

$ snmpstatus localhost

What do you observe ?

Test your neighbors

Check now that you can run snmpstatus against your other group members servers:

$ snmpstatus www.'your neighbors domain.ws.ac.lk
Note: See TracWiki for help on using the wiki.