SNMP over UDP is fundamentally a request/response protocol that doesn’t guarantee delivery, making it surprisingly resilient to network blips for monitoring but a poor choice for critical control.

Let’s see it in action. Imagine a network engineer, Alex, wants to check the CPU load on a server 192.168.1.100. Alex uses the snmpwalk command, a common tool for querying SNMP-enabled devices:

snmpwalk -v 2c -c public 192.168.1.100 .1.3.6.1.2.1.25.3.3.1.2

Here’s what’s happening:

  • -v 2c: Specifies SNMP version 2c, a widely supported, unencrypted version.
  • -c public: Sets the community string to public. Think of this as a read-only password. If this doesn’t match the server’s configuration, the request will be ignored.
  • 192.168.1.100: The IP address of the target server.
  • .1.3.6.1.2.1.25.3.3.1.2: This is an Object Identifier (OID) for "hrProcessorLoad", which represents the current CPU utilization of each processor on the host.

The server 192.168.1.100, if configured for SNMP, will receive this UDP packet on port 161. It looks up the requested OID and, if it has the data, crafts a UDP response packet containing the CPU load (e.g., Uptime: INTEGER: 75) and sends it back to Alex’s monitoring station, also typically on port 161.

The beauty of UDP here is its speed. There’s no handshake, no connection state to maintain. The server just sends the data if it can. This is why SNMP over UDP is so prevalent for monitoring. A dropped packet means Alex might miss a single CPU load reading, but the next poll will likely succeed. This is a far cry from TCP, where a dropped packet would cause a retransmission and a delay, potentially impacting the responsiveness of the monitoring system itself.

SNMP’s internal structure is a hierarchy of managed objects. Each device (router, server, printer) exposes a Management Information Base (MIB). A MIB is like a structured database of information about the device, organized into a tree. OIDs are the unique addresses within this tree. Alex’s snmpwalk command traverses a specific branch of this tree to get CPU information.

The key levers Alex controls are:

  • Community Strings: These are the "passwords." public is the default read-only, and private is often the default read-write. Never use defaults in production. A common security practice is to use non-standard, complex community strings for read-only access and restrict them to specific IP addresses on the network device’s firewall.
  • SNMP Version: Version 1 and 2c are unencrypted and vulnerable to eavesdropping. SNMPv3 adds authentication and encryption, making it secure but also more complex to configure. For sensitive environments, always use v3.
  • Target OIDs: Knowing which OIDs to query is crucial. Standard MIBs (like MIB-II, RFC 1213) cover basic network and system information. Vendor-specific MIBs provide details about device-specific features. Tools like snmpget are used to retrieve individual OID values, while snmpwalk is for iterating through a branch.
  • Firewall Rules: SNMP agents listen on UDP port 161. Firewalls must be configured to allow incoming UDP traffic on port 161 from authorized monitoring stations to the SNMP agents. Conversely, SNMP managers (where snmpwalk runs) need to be able to send UDP packets to port 161 on the agents.

The fact that SNMP uses UDP means that the SNMP manager must implement its own logic for retrying failed requests. The SNMP agent doesn’t know if the request arrived, and the manager doesn’t know if the response was received unless it times out and tries again. This is why monitoring tools often have configurable polling intervals and retry counts. If a device is intermittently unreachable, a shorter polling interval might miss data, while a longer one might lead to stale information.

Beyond basic polling, SNMP supports Traps and Inform messages, which are unsolicited notifications sent by the agent to the manager. Traps are also UDP-based and fire-and-forget. Inform messages, however, are sent over UDP but require acknowledgment from the manager, adding a layer of reliability for critical alerts that the standard request/response mechanism lacks.

The next step in mastering network monitoring is understanding SNMP Traps and how to configure devices to send them for proactive event notification.

Want structured learning?

Take the full Udp course →