SNMP v1 and v2c packet

Simple Network Management Protocol packet version 1 and version 2c use the same format because they both depend on community based security. Community based security depends on a shared community name value between the manager and agent for information authenticity to be verified.

SNMP packet is the first level sequence encoding that wraps all SNMP data sent in the packet. Packet sequence encoding is very simple:

  • Sequence type: always 0×30 byte value
  • Length of the packet

Packet sequence contains following values encoded within it:

  • Protocol version – encoded as Integer32 TLV
  • SNMP community – encoded as OctetString TLV
  • Protocol Data Unit – a child sequence containing the actual request/reply data

As you can see SNMP v1 and v2c packet format is very simple. Packet itself does not contain a lot of useful information. When processing incoming SNMP packet you only need to verify that you are dealing with the right protocol version and that community name matches the value you expected.

All useful information is stored in the Protocol Data Unit (Pdu class) which will be described in more detail in another article.