Syslog tells you what a device decided to say; (the Simple Network Management Protocol) lets a monitoring system ask. A manager reads interface counters and other managed objects from every switch on a schedule, and the switch sends its own notifications when, for example, a link goes down. Its first two versions protect all of this with a password sent in the clear. Chapter 4.5 of the open course LAN Switch Operations and Maintenance configures SNMP command by command on the 2007 platform and on current switch operating systems; this article is the protocol behind those commands.

Managers, agents and two ports

The architecture standard describes two roles. Managed nodes run "command responder and notification originator applications", which are "traditionally called agents"; at least one system runs "command generator and/or notification receiver applications (traditionally called a manager)" (RFC 3411). The same document sorts the operations into classes: the Read Class (GetRequest, GetNextRequest and GetBulkRequest), the Write Class (SetRequest) and the Notification Class (the SNMPv2 Trap and InformRequest).

The transport mapping suggests that agents "listen on UDP port 161" and that notification receivers "listen on UDP port 162" (RFC 3417). Polls therefore flow from the manager to 161 on every device, and notifications from every device to 162 on the manager: the two SNMP flows an access control list protecting the management plane has to allow.

Traps and informs

A device can report an event in two ways. A trap is fire and forget: "There is no confirmation associated with this notification delivery mechanism." An inform is acknowledged by the receiver with a Response: "This is a confirmed notification delivery mechanism, although there is, of course, no guarantee of delivery" (RFC 3416). The choice is made per destination: the notification table's type is trap(1) or inform(2), trap by default, and for a confirmed notification the sender also needs "the number of retries and retransmission algorithm", with a default retry count of 3 (RFC 3413).

Informs cost something: they "consume more network, router, and switch resources", because "an inform is held in memory until a response is received or the timeout is reached", and Juniper's advice is to "use informs when it is important that the SNMP manager receive all notifications" (Juniper, SNMPv3 informs). SNMPv3 adds one step. For a message that expects a response, "the receiver of such messages is authoritative" (RFC 3414), so the switch must know the manager's engine ID before it can authenticate an inform: Junos has it configured as a remote engine (Juniper, as above), and Extreme's Fabric Engine discovers it automatically "so that Inform messages are populated properly and not rejected by the SNMP Manager" (Extreme Networks, Fabric Engine 9.4, SNMPv3).

Versions 1, 2c and 3

SNMPv1SNMPv2cSNMPv3
Specification 1157RFC 1901RFCs 3411 to 3418, together STD 62
Status in the RFC indexHistoricHistoricInternet Standard
How a request is authorizeda community string, in clear texta community string, in clear texta user, with authentication and optional encryption
GetBulk and Informnoyesyes

The status row is the RFC Editor's index as read on 2 November 2026 (RFC 1157, RFC 1901, RFC index). GetBulk and Inform arrived with the version 2 operations, and the coexistence rules reflect it: a manager "MUST 'downgrade' GetBulk requests to GetNext requests" when it talks SNMPv1 to a device, and a proxy forwards an inform only "using the SNMPv2c or SNMPv3 message version" (RFC 3584).

The 's verdict on the first two is unambiguous. Versions 1 and 2c "support only trivial authentication based on plain-text community strings and, as a result, are fundamentally insecure", and both were declared Historic "to send a clear message that the third version of the Internet Standard Management Framework is the framework of choice" (RFC 3410). The same document expected vendors to keep shipping them, and asked that users "exercise sufficient due diligence" so that configurations "limit access via SNMPv1 and SNMPv2c appropriately". A community string is, in Juniper's words, "a password to control the client's access" (Juniper, SNMP communities), and in versions 1 and 2c that password crosses the network in plain text with every request.

SNMPv3 and the User-based Security Model

SNMPv3 replaces the community with a user. The architecture recognizes three security levels: "without authentication and without privacy (noAuthNoPriv)", "with authentication but without privacy (authNoPriv)" and "with authentication and with privacy (authPriv)" (RFC 3411). There is no fourth combination: the User-based Security Model () makes "no provision for data confidentiality without both data integrity and data origin authentication" (RFC 3414).

Authentication protects against modification and masquerade; privacy adds protection against disclosure. Each message also carries the authoritative engine's boot count and time, and a message outside a Time Window of "150 seconds" is not accepted, which limits replay. Two threats are out of scope by design: denial of service and traffic analysis (RFC 3414). Privacy encrypts the scoped PDU, the part that carries the request and its data; the header and the security parameters, user name included, are not encrypted (RFC 3414; Extreme, as above).

Keys are bound to the device. A password is turned into a key, and then into a localized key by hashing it with the snmpEngineID of the authoritative engine, so that "the actual secrets shared between the user and each authoritative SNMP engine will be different" (RFC 3414). Two consequences follow. The engine ID must be fixed before users are created: Juniper tells you to "configure the local SNMP engine ID before creating SNMPv3 USM users", because the system uses it "to generate SNMPv3 user authentication and privacy keys" (Juniper, configure SNMPv3). And passwords must be "at least 8 characters in length"; repetition does not help, since "a password 'bertbert' will result in exactly the same key as password 'bertbertbert'" (RFC 3414).

The algorithms the standards define

UseProtocolDefined inNote
Authentication--96RFC 3414MD5; new designs "should not employ HMAC-MD5" (RFC 6151)
AuthenticationHMAC--96RFC 3414SHA-1
AuthenticationHMAC-SHA-224, 256, 384 and 512RFC 7860SHA-256 is mandatory to implement, SHA-512 recommended
Privacy-DESRFC 341456-bit key
PrivacyCFB128--128RFC 3826AES with a 128-bit key

The original USM offered HMAC-MD5-96, HMAC-SHA-96 and CBC-DES, and said they "can be replaced or supplemented in the future" (RFC 3414). DES "uses only 56 bits" of its key (RFC 3414), and withdrew the standard that defined it, 46-3, on 19 May 2005 (NIST, FIPS 46-3). RFC 3826 added AES "with a key size of 128 bits" (RFC 3826), and RFC 7860, which obsoletes RFC 7630, added four HMAC-SHA-2 protocols, of which implementations "MUST support usmHMAC192SHA256AuthProtocol and SHOULD support usmHMAC384SHA512AuthProtocol" (RFC 7860). On MD5, the 's guidance is that "It is not urgent to stop using MD5 in other ways, such as HMAC-MD5", but that new protocol designs should avoid it (RFC 6151). No other current RFC in the index defines a USM authentication or privacy protocol, so an AES option with a longer key on a device's menu follows some other specification.

Support varies by platform, and the manager and the agent must match. Junos added authentication-sha256 in Release 21.1R1 (Juniper, authentication-sha256); Extreme's Fabric Engine 9.4 lists HMAC-MD5 and HMAC-SHA-96, using "HMAC-SHA1-96 with 160-bit key length" by default, with DES and AES for privacy (Extreme, as above). A minimal read-only authPriv user on Junos, from Juniper's own statements (the engine ID line is Juniper's example; set it before the user):

set snmp engine-id use-mac-address
set snmp v3 usm local-engine user nms authentication-sha256 authentication-password "<auth-password>"
set snmp v3 usm local-engine user nms privacy-aes128 privacy-password "<priv-password>"
set snmp v3 vacm security-to-group security-model usm security-name nms group NMS-RO
set snmp v3 vacm access group NMS-RO default-context-prefix security-model usm security-level privacy read-view MON
set snmp view MON oid 1.3.6.1.2.1 include

MIBs and OIDs as you meet them

Everything SNMP reads is an object in a (management information base), named by an object identifier (). The tree's top is fixed by the SMI: internet is { iso 3 6 1 }, mgmt is { internet 2 }, mib-2 is { mgmt 1 }, and enterprises is { private 1 } under private, { internet 4 } (RFC 2578). So 1.3.6.1.2.1 is the standard MIB-2 subtree, and 1.3.6.1.4.1 is where vendors register their own: the value of sysObjectID is "allocated within the SMI enterprises subtree (1.3.6.1.4.1)" (RFC 3418), and Juniper's example view for its alarms is 1.3.6.1.4.1.2636.3.4 (Juniper, configure SNMPv3).

Two rules turn a name into what a poller asks for. A single-valued object gets "a sub-identifier of zero" appended (RFC 2578): sysDescr is { system 1 } with system at { mib-2 1 } (RFC 3418), so the query is for 1.3.6.1.2.1.1.1.0. A column in a table is indexed by its row instead: ifHCInOctets is { ifXEntry 6 } in the Interfaces Group MIB (RFC 2863), and its rows are indexed by ifIndex, so the interface whose ifIndex is 5 answers at 1.3.6.1.2.1.31.1.1.1.6.5.

Counters need care. A Counter32 "wraps around and starts increasing again from zero" after 4294967295, and "a single value of a Counter has (in general) no information content" (RFC 2578): a rate is the difference between two polls. RFC 2863 therefore requires 64-bit octet counters on interfaces faster than 20,000,000 bits per second, and 64-bit packet counters as well from 650,000,000 bits per second. The arithmetic shows why: 2 to the power 32 octets is about 34.4 gigabits, so a 32-bit octet counter on a 10 Gb/s port running at full rate wraps in under four seconds. Counters also jump when the management system is re-initialised, and ifCounterDiscontinuityTime records "the value of sysUpTime" at the last such discontinuity (RFC 2863). The SNMP counter wrap and rate calculator does this arithmetic for any counter, speed, load and poll interval, and turns two readings into a rate.

What these messages look like on the wire, byte by byte, is in SNMP decoded.

A checklist for a switch fleet

  • Give monitoring a read view and nothing more. Access rights are granted per group and security level as "a read-view, a write-view and a notify-view", each a set of included or excluded subtrees (RFC 3415). A poller needs no write view.
  • Use authPriv for every user. Pick SHA-2 authentication where both ends support it, and AES for privacy; keep engine IDs stable.
  • Restrict who may ask. The standard ties a community to the addresses it is valid from (RFC 3584, snmpCommunityTransportTag), but on Junos "If no clients statement is present, all clients are allowed" (Juniper, SNMP communities), and SNMPv3 on Junos "does not support client list for access restriction" (Juniper, configure SNMPv3). Filter at the control plane instead: a Junos filter on lo0 is applied "only to packets that are sent to the Routing Engine CPU" (Juniper, firewall filters for EX), and Fabric Engine's access policies, based on "user access levels and network address", cover SNMP (Extreme, as above).
  • Retire v2c in order. Inventory every poller and trap receiver that still uses a community, give each an SNMPv3 user, move it, and only then delete the communities. Until then, keep any community read-only and limited by source.
  • Poll counters, trap state changes. Poll the 64-bit interface counters at a fixed interval. Take linkUp and linkDown as notifications, whose default setting under ifLinkUpDownTrapEnable should limit them to "one per interface per linkUp/linkDown event" (RFC 2863), along with coldStart and authenticationFailure, the latter switched by snmpEnableAuthenTraps (RFC 3418). Send the events that must not be lost as informs.
  • Keep the clocks honest. Every SNMPv2 trap and inform starts with sysUpTime.0 and snmpTrapOID.0 (RFC 3416), and sysUpTime counts hundredths of a second since the agent "was last re-initialized" (RFC 3418), not a date. Matching an event with syslog and TACACS+ accounting needs devices that agree on the time.

How SNMP came to be, and why version 2's security failed, is told in the observability family history.

What to remember

  • Agents answer on UDP 161; notifications go to UDP 162 on the manager.
  • A trap is never acknowledged; an inform is acknowledged and retried, but is still not guaranteed, and costs memory on the sender.
  • SNMPv1 and v2c are Historic: their community string is a clear-text password. SNMPv3 (STD 62) is the standard.
  • USM has three levels; use authPriv, with HMAC-SHA-2 (RFC 7860) and AES-128 (RFC 3826) where both ends support them.
  • USM keys are localized with the engine ID: set it first, and keep it stable.
  • Poll 64-bit counters and compute deltas; take link and restart events as notifications.

Sources