Is SNMPv3 a new protocol or SNMPv2 with security added, and what actually changes in an SNMPv3 message?
answer
- same operations document
- version field in the same place
- header flags say auth and priv
- a context travels with the PDU
- no community field at all
basics
~20 sSNMPv3 keeps SNMPv2's PDUs and operations from RFC 3416 and replaces the message around them: msgVersion 3, a header with message ID, maximum size, flags and security model, security-model parameters, and a scoped PDU naming a context, optionally encrypted.
solid answer
~40 sRFC 3410 says SNMPv3 "can be thought of as SNMPv2 with additional security and administration capabilities": the Get, GetNext, GetBulk, Set, Response, SNMPv2-Trap, Inform and Report PDUs are the RFC 3416 ones. What changes is the RFC 3412 message. `msgVersion` is 3 and sits where v1 and v2c put their version, so one engine can recognise all three. `msgGlobalData` carries `msgID`, `msgMaxSize`, `msgFlags` (the `authFlag`, `privFlag` and `reportableFlag` bits) and `msgSecurityModel` (3 for USM). `msgSecurityParameters` is an octet string whose format the security model defines. `msgData` is a scoped PDU, `contextEngineID`, `contextName` and the PDU, either in plain text or encrypted. There is no community field. Behind the message sits RFC 3411's modular architecture, with message processing, security and access control as replaceable subsystems.
go deeper
Recall that SNMPv3 uses the same operations as SNMPv2c; what changes is the message wrapper, which drops the community and adds security.
Walk through the RFC 3412 message: msgVersion, the header with msgFlags and msgSecurityModel, the security parameters and the scoped PDU with its context. Say which field states the security level.
Use the architecture to reason about deployments: a multilingual agent dispatches by version, maps communities into the same access control, and can be given other security or transport models without new operations.
Treat the modular architecture as the migration lever: one access-control model can govern every version during transition, and a TLS-based transport model is an option where certificate infrastructure already exists.
## One set of operations, three wrappers A common misconception is that SNMPv3 is a different protocol with different operations. It is not. The protocol operations are specified once, in **RFC 3416** ("Version 2 of the Protocol Operations for SNMP"), and that document is part of STD 62, the SNMPv3 Internet Standard. RFC 3410 describes SNMPv3 as "SNMPv2 with additional security and administration capabilities". The differences between versions live in the **message wrapper**: | Version | Version field | Wrapper | Who is speaking | |---|---|---|---| | SNMPv1 | 0 | version, community, PDU | whoever knows the community | | SNMPv2c | 1 | version, community, PDU | whoever knows the community | | SNMPv3 | 3 | version, header, security parameters, scoped PDU | a named principal, at a stated security level | The value 2 is not used on the wire by any surviving version; RFC 3411 reserves message processing model 2 for SNMPv2u and SNMPv2*, the abandoned secure SNMPv2 designs. ## The SNMPv3 message, field by field RFC 3412 defines the `SNMPv3Message`: 1. **`msgVersion`**: set to `snmpv3(3)`. An ASN.1 comment in RFC 3412 notes that this element is "in same position as in SNMPv1 and SNMPv2c, allowing recognition". 2. **`msgGlobalData`**, the header: - `msgID` correlates a request with its response inside the engine. - `msgMaxSize` is the largest message the sender can accept (at least 484 octets). - `msgFlags` is one octet: `authFlag`, `privFlag` and `reportableFlag`. The combinations give `noAuthNoPriv`, `authNoPriv` and `authPriv`; privacy without authentication is reserved and must not be used. - `msgSecurityModel` says which security model processes the message; RFC 3411 assigns 3 to the User-based Security Model (USM). 3. **`msgSecurityParameters`**: an octet string whose contents the security model defines. For USM it carries what the receiver needs to authenticate and decrypt the message. 4. **`msgData`**: a `ScopedPDU`, either `plaintext` or `encryptedPDU`. A scoped PDU is `contextEngineID`, `contextName` and the PDU itself. The **context** is new with SNMPv3: one engine may expose several collections of management information, and the scoped PDU says which one the PDU addresses. A community-based message has no such field; RFC 3584 maps each community to a context through its `snmpCommunityTable`. ## The architecture behind the message RFC 3411 splits an SNMP engine into a **dispatcher**, a **message processing subsystem**, a **security subsystem** and an **access control subsystem**, each holding numbered models: | Kind of model | SNMPv1 | SNMPv2c | SNMPv3 | |---|---|---|---| | Message processing model | 0 | 1 | 3 | | Security model | 1 (community-based) | 2 (community-based) | 3 (USM) | This is what lets one agent be **multilingual**: the dispatcher reads the version, hands the message to the matching model, and with RFC 3584's community mappings every version can be governed by the same access-control model. RFC 3410 calls a system supporting v1, v2c and v3 at once "tri-lingual". It is also how later work fits in without changing the operations: RFC 5590 adds a transport subsystem, and RFC 6353 defines a TLS and DTLS transport model used with the Transport Security Model of RFC 5591, an alternative to USM. ## What does not change - The PDUs, their tags and their semantics, including GetBulk and Inform. - The MIB objects and the SMI that defines them. - The UDP transport and the usual ports, 161 for requests and 162 for notifications (RFC 3417). ## What an observer still sees Encryption in SNMPv3 covers the scoped PDU only. Someone capturing an `authPriv` request still sees: - `msgVersion`, `msgID`, `msgMaxSize`, `msgFlags` and `msgSecurityModel` from the header; - the security parameters, which for USM include the user name in plain text; - nothing of the context or the PDU, because the whole `ScopedPDU` travels as `encryptedPDU`. So SNMPv3 hides what is being asked and answered, not who is asking. That is still a long way from a community string, which hands an observer the credential itself. ## What is handed to the security model How USM derives and localises keys, discovers the authoritative engine and checks the time window, and how view-based access control builds its views, are the SNMPv3 security model's business. One piece is visible at this level: the `Report-PDU`, whose usage RFC 3416 leaves to the administrative framework, is what SNMPv3 engines use to signal problems such as an unknown engine or user back to the sender.
- Why does msgVersion sit in the same position as the version field of SNMPv1 and SNMPv2c?So one engine listening on one port can tell the versions apart before parsing anything else. The dispatcher reads the first field, picks the matching message processing model (0 for SNMPv1, 1 for SNMPv2c, 3 for SNMPv3) and hands the rest over. RFC 3412's ASN.1 says so in a comment: the element is in the same position as in SNMPv1 and SNMPv2c, allowing recognition.
- What do contextEngineID and contextName in the scoped PDU add?They say which collection of management information the PDU addresses, since one engine may hold several contexts, for example one per logical instance it manages. Community-based messages have no context field, so RFC 3584's `snmpCommunityTable` maps each community to a context engine ID and a context name, letting a multilingual agent treat both kinds of request alike.
saying these in an interview costs you the question
- SNMPv3 introduced new operations, so SNMPv2 PDUs cannot travel inside it.
- SNMPv3 encrypts every message, whatever the security level.
- An SNMPv3 message still carries a community string for backward compatibility.
- SNMPv3 only works over TLS.
- msgSecurityModel states whether the message is authenticated or encrypted.