snmp2Simple Network Management Protocol v2cMIB-Free LinkDown Traps, Informs & GetBulk Sweeps (snmp2)
What It Does on the Wire
Testing a Zabbix, PRTG, or Prometheus alert rule from your desk? snmp2 trap and snmp2 inform pack sysUpTime.0, snmpTrapOID.0, and 64-bit counter64 varbinds straight from numeric OIDs.
Simple Network Management Protocol v2c (snmp2, RFC 3416) upgrades SNMPv1 (version = 1) with high-throughput getbulk table retrieval (0xa5 using nonrepeaters and maxrepetitions), 64-bit counter64 ifXTable interface counters, acknowledged inform notifications (0xa6), and unified varbind-based SNMPv2-Trap (0xa7) framing.
When sysuptime is provided on snmp2 trap, inform, or report, FrameAssembly automatically prepends the mandatory RFC 3416 sysUpTime.0 (1.3.6.1.2.1.1.3.0) varbind ahead of your snmpTrapOID.0 (1.3.6.1.6.3.1.1.4.1.0) and payload varbinds.
Zabbix, LibreNMS & Prometheus snmp_exporter GetBulk Walks
Test ifXTable (1.3.6.1.2.1.31.1.1.1) 64-bit ifHCInOctets (counter64) bulk walks with nonrepeaters and maxrepetitions on UDP 161.
RFC 3416 linkDown / linkUp & BGP Peer Notification Testing
Emit standard snmp2 trap and acknowledged snmp2 inform + response exchanges carrying varbind 1.3.6.1.6.3.1.1.4.1.0 oidval <trap_oid> on UDP 162.
SNMP Amplification & Unsolicited Trap Firewall Filtering
Verify perimeter ACLs and rate-limiters against spoofed snmp2 getbulk maxrepetitions 50 amplification probes.
Minimal Quickstart (snmp2_quickstart.frasm)
Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.
host core_sw { ip 10.20.1.1 }host nms_srv { ip 10.20.1.50 }compile { nms_srv -> core_sw snmp2 getbulk community "ops-ro" reqid 501 nonrepeaters 0 maxrepetitions 10 oid 1.3.6.1.2.1.31.1.1.1.6 wait 2ms nms_srv <- core_sw snmp2 response community "ops-ro" reqid 501 varbind 1.3.6.1.2.1.31.1.1.1.6.1 counter64 98765432100}What the Compiler Calculates So You Don't Have To
- Encodes
GetBulkRequest(0xa5) overloading the BER error-status and error-index slots withnonrepeaters(default0) andmaxrepetitions(default10) per RFC 3416. - Automatically prepends
1.3.6.1.2.1.1.3.0(sysUpTime.0TimeTicks) ontrap(0xa7),inform(0xa6), andreport(0xa8) whensysuptimeis specified. - Routes
trap,inform, andreportto UDP162andget/getnext/getbulk/setto UDP161, reversing ports automatically on<- response.
ifXTable 64-Bit Counter Walk + Acknowledged SNMPv2c LinkDown Inform
Walks 64-bit high-capacity interface counters via getbulk on UDP 161, then delivers a reliable snmp2 inform (linkDown 1.3.6.1.6.3.1.1.5.3) on UDP 162 with manager response acknowledgment.
host nms_poller { ip 10.30.10.20 }host dist_sw { ip 10.30.10.1 }compile { // 1. High-capacity 64-bit interface counter bulk poll on UDP 161 nms_poller -> dist_sw snmp2 getbulk community "infra-ro" reqid 2001 nonrepeaters 1 maxrepetitions 5 varbind 1.3.6.1.2.1.1.3.0 null varbind 1.3.6.1.2.1.31.1.1.1.6 null wait 2ms nms_poller <- dist_sw snmp2 response community "infra-ro" reqid 2001 varbind 1.3.6.1.2.1.1.3.0 timeticks 43200000 varbind 1.3.6.1.2.1.31.1.1.1.6.101 counter64 184502910440 varbind 1.3.6.1.2.1.31.1.1.1.1.101 string "TenGigabitEthernet1/0/1" wait 5ms // 2. Acknowledged SNMPv2c InformRequest for linkDown (1.3.6.1.6.3.1.1.5.3) on UDP 162 dist_sw -> nms_poller snmp2 inform community "infra-trap" reqid 9001 sysuptime 43200500 varbind 1.3.6.1.6.3.1.1.4.1.0 oidval 1.3.6.1.6.3.1.1.5.3 varbind 1.3.6.1.2.1.2.2.1.1.101 int 101 varbind 1.3.6.1.2.1.2.2.1.8.101 int 2 wait 1ms dist_sw <- nms_poller snmp2 response community "infra-trap" reqid 9001 varbind 1.3.6.1.2.1.1.3.0 timeticks 43200500 varbind 1.3.6.1.6.3.1.1.4.1.0 oidval 1.3.6.1.6.3.1.1.5.3}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show snmp2_getbulk_and_inform.frasm
# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly snmp2_getbulk_and_inform.frasm snmp2_getbulk_and_inform.pcap
frameassembly snmp2_getbulk_and_inform.frasm snmp2_getbulk_and_inform.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse snmp2_getbulk_and_inform.pcap snmp2_getbulk_and_inform_edited.frasmAll snmp2 Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after snmp2:
src_host -> dst_host snmp2 [trap | inform | report | get | getnext | getbulk | set | response] [community "<text>"] [reqid <number>] [nonrepeaters <number>] [maxrepetitions <number>] [sysuptime <number>] [oid <oid>] [varbind <oid> <type_val> ...]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| trap | inform | report | get | getnext | getbulk | set | response | SNMPv2c PDU type keyword | trap (PDU 0xa7 on UDP 162) | Selects RFC 3416 BER PDU tag (0xa0..0xa3 or 0xa5 GetBulk, 0xa6 Inform, 0xa7 SNMPv2-Trap, 0xa8 Report). |
| community "<text>" | Double-quoted OCTET STRING | "public" | Sets the SNMPv2c community string. |
| nonrepeaters <number> | maxrepetitions <number> | Whole number | nonrepeaters 0, maxrepetitions 10 | Sets scalar non-repeaters count and tabular max-repetitions row count on getbulk PDUs. |
| sysuptime <number> | 32-bit TimeTicks (1/100s) | Omitted (or auto-prepended when set) | Prepends 1.3.6.1.2.1.1.3.0 = TimeTicks(<sysuptime>) as the first varbind on trap, inform, and report. |
| reqid <number> | oid <oid> | u32 request ID, dotted OID | reqid 1, oid 1.3.6.1.2.1.1.1.0 | Sets 32-bit request-id and appends a NULL-valued query OID. |
| varbind <oid> <type_val> | Repeatable: string "<s >" | int <number> | oidval <oid> | ipval <ipv4> | counter32 <number> | gauge32 <number> | timeticks <number> | counter64 <number> | null | Omitted | Appends typed SMIv2 VarBind entries (use 1.3.6.1.6.3.1.1.4.1.0 oidval <oid> for snmpTrapOID.0). |
Cross-Layer Wrappers Valid with snmp2
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
10 options
Cross-Layer Wrappers Valid with snmp2
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | Colon, hyphen, or Cisco dot MAC | Host MAC / RFC multicast MAC | Overrides the 14-byte Ethernet II source or destination MAC address for this single packet. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255 | Unlabeled (at most 1 mpls tag per packet) | Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] | IPv4 ID, DF/MF flags, fragment offset 0..8191 | ipid 1, flags 0, fragoffset 0 | Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts). |
| srcport <0..65535> | dstport <0..65535> | Port number 0..65535 | srcport 49152 (remembered), UDP 162 (trap/inform) / UDP 161 (get/getbulk) | Overrides source or destination port and remembers the port pair automatically on <- replies. |
Gotchas & Quick Fixes
Pass snmpTrapOID.0 via varbind 1.3.6.1.6.3.1.1.4.1.0 oidval <oid> (Never trapoid)
dist_sw -> nms_poller snmp2 trap trapoid 1.3.6.1.6.3.1.1.5.3dist_sw -> nms_poller snmp2 trap sysuptime 5000 varbind 1.3.6.1.6.3.1.1.4.1.0 oidval 1.3.6.1.6.3.1.1.5.3In RFC 3416 SNMPv2c/v3, trap OIDs are regular varbinds rather than dedicated v1 header slots. Pass 1.3.6.1.6.3.1.1.4.1.0 (snmpTrapOID.0) with the oidval type keyword.
Use string (Not str) for Text Varbinds
dist_sw -> nms_poller snmp2 response varbind 1.3.6.1.2.1.1.5.0 str "core-sw"dist_sw -> nms_poller snmp2 response varbind 1.3.6.1.2.1.1.5.0 string "core-sw"Always write string "<value>" for OCTET STRING varbinds across snmp1, snmp2, and snmp3.