Table of Contents

Set up and use SNMP on the router

Goal

Setting up the SNMP function on the router so that you can then query OID. For this, all installation steps on the server and client side are shown. Node RED is used in the second step for a web-based display.

Prerequisites

For the implementation with Node RED in the second step

1. Set up SNMP on the router

Enable the SNMP function on the router.

You can add information to the two parameters “Contact” and “Location”.

For the “Operation mode” parameter, you can restrict the query options.

For the “Listening port” option, you can specify a port other than the standard port 161. It is important that you then always specify the port when making a request. Otherwise, a client would always use port 161 for the request if it is not specified.

Further settings can be stored under the “Authentication” tab.

If you need more than just reading rights and need to query deeper structures of the OID. Must be activated for the admin account to access.

The question of who can make a request can be restricted again using “Allowed host”. In this test, access was granted to everyone.

To access it, you have to make a change in the user administration.

Please select the pencil icon on the right.

Under this mask, you have to enable the “Store password unencrypted” option for the SNMP query.

The server side of SNMP would then be set up for the time being.

For more information, you can also refer to the manual.

2. Setting up the SNMP client side for the query

The queries are carried out via a Linux client on the console.

To do this, you need to install a few programs and adjust a few settings. Debian is used as the Linux system.

The “snmp” package must be installed for the query. The command “sudo apt-get install snmp” installs the program with all the necessary components.

USER
:~$ sudo apt-get install snmp

Next, please install the standard MIB file for SNMP on the computer. This is set up with the command “sudo apt-get install snmp-mibs-downloader”.

USER
:~$ sudo apt-get install snmp-mibs-downloader

Now you still need to customize settings and store the NetModule MIB file on the computer.

First create a subdirectory in the Linux user's home directory. It is important that the file name is .snmp. The dot before the name is important for the file.

USER
:~$ mkdir .snmp :~$ ls -a .snmp/

Please change to the directory .snmp with the command “cd”

USER
:~$ cd .snmp/ :~/.snmp$

Now a subdirectory for the NetModule MIB file must be created with mkdir.

USER
:~/.snmp$ mkdir mibs

Next, a snmp.conf control file for the MIB file is still needed. This can be created using the “vi” program.

USER
:~/.snmp$ vi snmp.conf

Output file contents :~/.snmp$ cat snmp.conf mibs +NB-MIB

This entry “mibs +NB-MIB” must then be stored in this config file so that the NetModule MIB can then be accessed during queries.

You can download the NetModule MIB directly from the router.

The MIB file that you have downloaded still has to be stored in the SNMP subdirectory. This can be done with this command.

USER
:~/Downloads$ cp VENDOR-MIB.txt ~/.snmp/mibs/

:~/.snmp$ ls mibs snmp.conf

:~/.snmp$ ls mibs/ VENDOR-MIB.txt

3. Run some SNMP queries for testing and to see which queries are possible

For the first request a snmpwalk is used.

USER
:~$ snmpwalk -v2c -c admin 192.168.1.1 1.3.6.1.4.1.31496 NB-MIB::swVersion.0 = STRING: 4.8.0.103 NB-MIB::kernelVersion.0 = STRING: 4.19.163 NB-MIB::serialNumber.0 = STRING: 00112B015D79 NB-MIB::configDesc.0 = STRING: user-config …..

The second query is to test whether the NetModule MIB is stored and can be used.

USER
:~$ snmpget -v2c -c admin 192.168.1.1 serialNumber.0 NB-MIB::serialNumber.0 = STRING: 00112B015D79

If the OID is needed, you can cancel the resolution to the name or you can translate the name into an OID directly.

USER
:~$ snmpget -v2c -On -c admin 192.168.1.1 serialNumber.0 .1.3.6.1.4.1.31496.10.40.3.0 = STRING: 00112B015D79

:~$ snmptranslate -On -IR serialNumber.0 .1.3.6.1.4.1.31496.10.40.3.0

If a query is to be carried out with SNMP v3

USER
:~$ snmpwalk -v3 -l authNoPriv -u admin -a SHA -A admin2024 192.168.1.1/ 1.3.6.1.4.1.31496 NB-MIB::swVersion.0 = STRING: 4.8.0.103 NB-MIB::kernelVersion.0 = STRING: 4.19.163 NB-MIB::serialNumber.0 = STRING: 00112BFFDF16 ….

:~$ snmpget -v3 -l authNoPriv -u admin -a SHA -A admin2024 192.168.1.1/ serialNumber.0 NB-MIB::serialNumber.0 = STRING: 00112BFFDF16