Simple Network Management Protocol (SNMP)
Roles
A SNMP network consists of two different types of nodes:
- Managed devices: A node on the network that implements SNMP and allows read or read/write access to its information. Each Managed Device (MD) has an Agent that runs on it. The Agent is the software module responsible for communicating using SNMP. The term Agent is commonly used to refer the entire device.
- Network Management Station (NMS): A device used to configure and manage the network. Managed devices talk to the NMS. Also just called the Manager for short.
Versions
There are three versions of SNMP:
- SNMPv1: First version. As of 2024 this is still widely used and is the de facto network management protocol1.
- SNMPv2: SNMPv2 introduced the controversial party-based security model. This was seen as too complex for many users, and in response SNMPv2c was created.
- SNMPv2c: The same as SNMPv2, but with the party-based security model removed and replaced with the same community-based security model as SNMPv11. It ended up being much more popular than SNMPv2.
- SNMPv3: Adds more advanced security features such as encryption, authentication, and granular access control.
Network Hierarchy
SNMP sits in the application layer of the Internet Protocol Suite 4-layer framework. It uses UDP as it’s transport layer protocol1.
The NMS can send requests from any source port to managed devices listening on UDP port 161. The managed device responds back from port 161 to same port on the NMS.
The manager receives notifications such as traps on UDP port 162. The managed device can send these notifications from any available source port.
Management Information Base (MIB)
The Management Information Base (MIB) is a hierarchy that describes the variables.
An Object Identifier (OID) uniquely identifies a managed object in the MIB hierarchy2.
For example, the OID for Percentages of user CPU time (ssCpuUser)
(which is specified in the UCD-SNMP-MIB
MIB) in asn1 form is3:
This shows how to drill down in the MIB hierarchy to find the managed object. The top level is iso(1)
, the next level is identified-organization(3)
, and so on, all the way down to the managed objectssCpuUser(9)
. OIDs are typically written in dot notation, which just uses the numbers separated by dots. So the OID becomes:
You can explore and find OIDs at the free online Global OID reference database.
Traps
SNMP traps are the event-based mechanism for managed devices to report events (such as errors) back to the NMS. Traps are one way, and the sending device does not expect acknowledgement or confirmation of delivery.
Generic Traps
Generic traps are defined and standardized by the Internet Engineering Task Force (IETF)4.
Embedded SNMP Libraries
lwIP
The lightweight IP stack (lwIP) library has built-in support for acting as SNMPv2c or SNMPv3 Agent. A MIB compiler and viewer (written in C# and Windows Forms) is also provided in the lwIP contrib repository5. The lwIP library is well supported by the Espressif ESP32 and ESP8266 MCUs.
Arduino_SNMP_Manager
Arduino_SNMP_Manager is an Arduino library (which appears to support the ESP32 and ESP8266)for implementing a SNMP Manager. It supports SNMPv1 and SNMPv2. It supports the GetRequest
and GetResponse
PDUs6.
0neblock/Arduino_SNMP
Arduino_SNMP is an Arduino library for implementing a SNMPv2c SNMP Agent. It was designed and tested with a ESP32, but should work with in any Arduino environment which has a UDP object available7.
Lantronix Ethernet to Serial Device Servers
The Lantronix XPort “Ethernet to Serial Device Servers” support SNMP (as well as ARP, ICMP, TFTP, DHCP, HTTP and other network protocols)8. This device easily allows you to add TCP/IP network capabilities to MCUs and other embedded devices which can’t otherwise natively support it.
Further Reading
Explore and find OIDs at the free online Global OID reference database.
Footnotes
-
Wikipedia (2024, Sep 27). Simple Network Management Protocol. Retrieved 2024-10-03, from https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol. ↩ ↩2 ↩3
-
Paessler. SNMP, MIBs and OIDs - an overview. Retrieved 2024-10-04, from https://www.paessler.com/info/snmp_mibs_and_oids_an_overview. ↩
-
SysAdmin. Most useful SNMP OIDs. Retrieved 2024-10-04, from https://www.sysadmin.md/most-useful-snmp-oids.html. ↩
-
Nolan Greene (2024, Jul 17). Mastering SNMP Traps. Auvik. Retrieved 2024-10-03, from https://www.auvik.com/franklyit/blog/snmp-traps/. ↩
-
lwIP. lwIP v2.1.0 - Modules > Application > SNMPv2c/v3 agent [documentation]. Retrieved 2024-10-04, from https://www.nongnu.org/lwip/2_1_x/group__snmp.html. ↩
-
GitHub. shortbloke/Arduino_SNMP_Manager [Git repository]. Retrieved 2024-10-03, from https://github.com/shortbloke/Arduino_SNMP_Manager. ↩
-
GitHub. 0neblock/Arduino_SNMP [Git repository]. Retrieved 2024-10-03, from https://github.com/0neblock/Arduino_SNMP. ↩
-
Lantronix. XPort Ethernet to Serial Device Server [product page]. Retrieved 2024-10-04, from https://www.lantronix.com/products/xport/. ↩ ↩2