On this page
SNMPv3 replaces the clear-text community string of SNMPv1 and v2c with named users, each with its own authentication key and, optionally, its own encryption key. Use it at the authPriv security level, with an HMAC-SHA-2 authentication protocol and AES-128 for privacy, and restrict what each user can read with a view.
The security comes from two parts of the SNMPv3 framework: the User-based Security Model in RFC 3414, which handles authentication, encryption and replay protection, and the View-based Access Control Model in RFC 3415, which decides which objects a user may read or write. The objects themselves, OIDs, MIB modules and counters, are unchanged from v2c and are covered on the SNMP and MIBs reference page. This page covers the v3 security layer and how to set it up without the usual failures.
01 What does SNMPv3 add over v2c?
An SNMPv2c request carries a community string such as public in clear text. Anyone who can capture the packet can read it and reuse it, and the agent cannot tell one poller from another. SNMPv3 adds three things:
- Authentication: each message carries an HMAC computed with the user's key, so the agent knows which user sent it and that it was not altered.
- Privacy: the PDU, the part with the OIDs and values, is encrypted with the user's privacy key.
- Timeliness: authenticated messages carry the agent's boot counter and uptime, and RFC 3414 rejects messages outside a 150-second window, which stops replay of captured requests.
Each user is configured at one of three security levels, named in the RFCs exactly as they appear in CLI commands:
| Level | Authentication | Encryption | Use it for |
|---|---|---|---|
noAuthNoPriv | Username only | None | Nothing in production; no better than a community string |
authNoPriv | HMAC per message | None, values visible on the wire | Isolated lab networks at most |
authPriv | HMAC per message | PDU encrypted | Every production poller and trap receiver |
02 Which authentication and privacy protocols should you choose?
RFC 3414 defined HMAC-MD5-96 and HMAC-SHA-96 for authentication and CBC-DES for privacy. All three are weak by current standards: MD5 and SHA-1 are deprecated hash functions, and DES uses a 56-bit key. Two later RFCs added the protocols to use now:
- RFC 3826 adds AES in Cipher Feedback mode with a 128-bit key, called
usmAesCfb128Protocol. This is what CLI options namedaes,aes 128orAESmean. - RFC 7860 adds four HMAC-SHA-2 authentication protocols, from SHA-224 to SHA-512. Implementations must support
usmHMAC192SHA256AuthProtocoland should supportusmHMAC384SHA512AuthProtocol; the SHA-224 and SHA-384 variants are optional.
| Protocol | Purpose | Defined in | Verdict |
|---|---|---|---|
| HMAC-MD5-96 | Authentication | RFC 3414 | Avoid |
| HMAC-SHA-96 (SHA-1) | Authentication | RFC 3414 | Only where nothing better is offered |
| HMAC-SHA-256 (192-bit tag) | Authentication | RFC 7860 | Use; mandatory to implement |
| HMAC-SHA-512 (384-bit tag) | Authentication | RFC 7860 | Use where both ends support it |
| CBC-DES | Privacy | RFC 3414 | Avoid |
| CFB128-AES-128 | Privacy | RFC 3826 | Use |
| AES-192, AES-256 | Privacy | Expired Internet-Draft, vendor extensions | Only after testing both ends together |
AES-192 and AES-256 appear on many devices but were never published as an RFC, and vendors differ in how they stretch the localized key to the longer length. A poller and an agent that both offer "AES-256" can still fail to decrypt each other's messages. AES-128 from RFC 3826 is the setting that interoperates.
03 Engine IDs, key localization and discovery
Every SNMPv3 entity has an snmpEngineID, a unique identifier usually derived from the device's MAC address or IP address. It matters for two reasons.
First, keys are localized. RFC 3414's password-to-key algorithm hashes the passphrase repeated out to one megabyte, then hashes that result together with the engine ID of the authoritative engine. The key stored on a router is therefore unique to that router, so a key extracted from one device does not authenticate to another, even when both use the same passphrase. The flip side: if a device's engine ID changes, for example after a chassis or supervisor swap, every user's stored key is wrong and users must be recreated.
Second, messages are bound to the authoritative engine. For a get or set, the agent is authoritative. A manager does not need to know the agent's engine ID in advance: it sends a discovery request, the agent replies with a report carrying its engine ID, boot count and time, and the manager uses those values from then on. The timeliness check uses the agent's own boot counter and uptime, not wall-clock time, so SNMPv3 does not need NTP to work.
Traps reverse that. For a trap the sending device is authoritative, so the trap receiver must already hold a user entry tied to each sending device's engine ID; no discovery happens. That is the most common reason v3 polling works and v3 traps are silently dropped. Informs make the receiver authoritative, so the sender discovers the receiver's engine ID and only one user entry is needed on the receiver. Informs are also acknowledged, which helps on links where traps get lost. The cost is a retransmit queue on the device: an unreachable receiver holds informs in memory until the retry count runs out, so set a sensible retry and timeout rather than leaving the defaults on hundreds of devices pointed at one collector.
04 How do you configure an SNMPv3 user?
The order below works on most platforms. Addresses use the 192.0.2.0/24 and 198.51.100.0/24 documentation ranges: the poller is 198.51.100.20 and the device is 192.0.2.10.
- Define a view that covers only what the poller needs. Start broad, such as the whole
isotree for read access, and narrow later. - Create a group bound to the
privsecurity level with that view for reading and no write view. - Restrict sources with an access list naming the poller addresses.
- Create the user in the group with SHA-2 authentication if the platform offers it, SHA-1 if not, and AES-128 privacy. Use long, different passphrases for authentication and privacy; many implementations reject passphrases shorter than eight characters.
- Configure the trap or inform target with the same user and security level.
- Remove community strings once the poller works over v3.
The view and group steps are VACM, the access control half of SNMPv3. A view is a list of OID subtrees, each included or excluded, so iso included with the snmpUsmMIB and snmpVacmMIB subtrees excluded gives a poller everything except the tables that describe users and access rules. A group ties a set of users and a security level to a read view, a write view and a notify view. RFC 3415 also defines contexts, which some platforms use to expose a separate MIB instance per VRF or per bridge domain; a poller that cannot find per-VRF routes is often querying the default context. Keep monitoring users read-only: a write view lets the user change configuration objects, and on many platforms that includes copying configuration files to and from a TFTP server.
On Cisco IOS:
access-list 99 permit 198.51.100.20
snmp-server view MONVIEW iso included
snmp-server group MONGRP v3 priv read MONVIEW access 99
snmp-server user monitor MONGRP v3 auth sha AUTH-PASSPHRASE priv aes 128 PRIV-PASSPHRASE
snmp-server host 198.51.100.20 informs version 3 priv monitor
snmp-server enable traps
no snmp-server community public
IOS hashes the user's keys and does not show the snmp-server user line in the running configuration; show snmp user lists the user, its group and protocols. Keep the passphrases in your password vault, because they cannot be recovered from the device. On a Linux host running Net-SNMP, the agent side is two lines in snmpd.conf, and the daemon replaces the createUser line with a localized key on first start:
createUser monitor SHA-256 "AUTH-PASSPHRASE" AES "PRIV-PASSPHRASE"
rouser monitor priv05 How do you test SNMPv3 and read the errors?
Test from the poller with the Net-SNMP command-line tools before you touch the monitoring system. A read of sysUpTime is the smallest useful test:
snmpget -v3 -l authPriv -u monitor -a SHA-256 -A 'AUTH-PASSPHRASE' \
-x AES -X 'PRIV-PASSPHRASE' 192.0.2.10 1.3.6.1.2.1.1.3.0
A value back means user, keys, protocols, view and ACL all line up. When it fails, the agent counts the reason in the usmStats counters defined in RFC 3414, and the error text on the poller usually names the same condition:
| Counter on the agent | Typical poller message | Usual cause |
|---|---|---|
| usmStatsUnknownUserNames | Unknown user name | Typo in the username, or the user was lost when the engine ID changed |
| usmStatsWrongDigests | Authentication failure | Wrong auth passphrase or auth protocol (SHA-1 on one side, SHA-256 on the other) |
| usmStatsDecryptionErrors | Decryption error | Wrong privacy passphrase, or AES-256 key-stretching mismatch |
| usmStatsUnsupportedSecLevels | Unsupported security level | Poller asks for authPriv, user configured as authNoPriv, or the reverse |
| usmStatsNotInTimeWindows | Usually retried silently | Stale cached boot count or time after the agent rebooted |
| usmStatsUnknownEngineIDs | Usually retried silently | Normal during discovery; persistent rises point to duplicate engine IDs |
A request that times out with no counter rising never reached the SNMP engine: check the access list, firewalls on UDP 161, and the view. A user whose view excludes the requested OID gets No Such Object rather than an error, which looks like a missing MIB.
06 Common SNMPv3 mistakes
- Duplicate engine IDs. Virtual appliances cloned from one image, or agents that derive the ID from a shared address, end up with the same engine ID. Pollers cache engine data per ID and get confused, and traps from both devices map to the same user entry.
- Traps configured like polls. The trap receiver needs each sender's engine ID. Use informs, or load every device's engine ID into the receiver.
- Leaving v1 and v2c enabled. Adding v3 users does not disable community strings. Remove them, or an attacker skips the v3 controls.
- authNoPriv by habit. Values, including interface descriptions and ARP tables, travel in clear text. Use authPriv.
- Write access in the same group as monitoring. Give the poller a read-only view; create a separate user for the rare system that needs SET.
- Assuming encryption covers the poller's storage. SNMPv3 protects the wire, not the monitoring database. Flow-based telemetry such as sFlow sampling to a collector has no equivalent built-in encryption and needs its own network isolation.
Old devices are a planning problem rather than a configuration one. Foundry IronWare and many other platforms of the 2000s support only MD5, SHA-1 and DES, or no v3 at all in some releases, and their security notices are listed on the Foundry security advisories page. Keep such devices on a dedicated management VLAN that only the poller can reach, never on the native VLAN of a trunk, use the strongest protocol they offer, and plan their replacement. The rest of the polling and telemetry topics are on the network monitoring hub.
07 Questions
What is the difference between SNMPv2c and SNMPv3?
SNMPv2c authenticates with a community string sent in clear text. SNMPv3 uses named users with per-message HMAC authentication, optional encryption of the PDU and a replay window. The MIB objects and operations are the same; only the security layer changes.
Which SNMPv3 security level should I use?
authPriv, which both authenticates and encrypts each message. authNoPriv sends values in clear text and noAuthNoPriv offers no protection beyond a username, so neither belongs on a production network.
Should I use SHA or SHA-256 for SNMPv3?
SHA-256 or SHA-512 from RFC 7860 where both the device and the poller support them. Plain SHA in older CLIs means SHA-1 (HMAC-SHA-96 from RFC 3414), which is acceptable only on devices that offer nothing newer. Avoid MD5.
Why do SNMPv3 polls work but traps do not arrive?
For traps the sending device is the authoritative engine, so the receiver needs a user entry tied to that device's engine ID and does no discovery. Configure informs instead, which make the receiver authoritative, or add each device's engine ID to the receiver.
Does SNMPv3 need NTP?
No. The 150-second timeliness check uses the agent's own boot counter and uptime, which the manager learns during discovery. NTP still matters for log and trap timestamps, but SNMPv3 authentication does not depend on synchronised clocks.
Why does AES-256 fail between two SNMPv3 devices?
AES-192 and AES-256 for SNMP were never published as an RFC, and vendors extend the localized key to the longer length in different ways. Use AES-128 from RFC 3826, which every compliant implementation handles the same way.