SNMP on Debian 13: snmpd, SNMPv3 Users, snmpwalk and Why Your OIDs Show Up as Numbers

If you run network gear, you already speak SNMP. If you have ever installed the tools on a fresh Debian box and typed snmpget ... sysDescr.0, you have also met this:

sysDescr.0: Unknown Object Identifier (Sub-id not found: (top) -> sysDescr)

I set up a Debian 13 agent and manager in two network namespaces to find out why, and to put v2c and v3 side by side with real captures.

Install

sudo apt install snmp snmpd snmptrapd
snmp      5.9.4+dfsg-2+deb13u1
snmpd     5.9.4+dfsg-2+deb13u1
snmptrapd 5.9.4+dfsg-2+deb13u1

snmp provides snmpget and snmpwalk, snmpd is the agent and snmptrapd receives traps and informs. snmptrapd is its own package on Debian 13, so installing snmpd alone does not give you a trap receiver.

My lab: the agent 10.70.0.1 in namespace ag and the manager 10.70.0.2 in namespace mg, joined by a veth pair. I ran my own snmpd instance in the agent namespace instead of the system service, so nothing below touched the VM’s real configuration.

The agent configuration

agentAddress udp:10.70.0.1:161
rocommunity labro 10.70.0.0/24
sysLocation  Lab rack 1
sysContact   noc@example.net
createUser labuser SHA-256 "authpass-1234" AES "privpass-1234"
rouser labuser priv
trap2sink 10.70.0.2:162 labtrap
  • agentAddress binds the agent to one address and port. Set it explicitly for a remote poller, and bind it to the management address instead of every interface.
  • rocommunity labro 10.70.0.0/24 is a read-only v2c community restricted to a source network. The source restriction is half the value of this line, because a community string is a password.
  • createUser defines an SNMPv3 user with SHA-256 authentication and AES encryption. rouser labuser priv grants read access, but only at the priv security level (authenticated and encrypted).
  • trap2sink points notifications at the manager.

Use passphrases of at least eight characters. SNMPv3 key material is derived from them.

Why the OIDs are numbers

Querying a name fails, but the same object by number works:

$ snmpget -v2c -c labro 10.70.0.1 .1.3.6.1.2.1.1.1.0
iso.3.6.1.2.1.1.1.0 = STRING: "Linux modern-tools 6.12.115+deb13.1-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.115-2 ...

The agent is fine. The manager just cannot translate numbers into names, because it has no MIB files for the standard objects. Look in the directory the tools search:

$ ls /usr/share/snmp/mibs
LM-SENSORS-MIB.txt        NET-SNMP-AGENT-MIB.txt   NET-SNMP-EXAMPLES-MIB.txt
NET-SNMP-EXTEND-MIB.txt   NET-SNMP-MIB.txt         NET-SNMP-PASS-MIB.txt
NET-SNMP-TC.txt           NET-SNMP-VACM-MIB.txt    UCD-DEMO-MIB.txt
UCD-DISKIO-MIB.txt        UCD-DLMOD-MIB.txt        UCD-IPFWACC-MIB.txt
UCD-SNMP-MIB.txt

Thirteen files, all Net-SNMP’s own. The standard ones (SNMPv2-MIB, IF-MIB, IP-MIB and the rest of the IETF set) belong in ietf and iana subdirectories that the tools search but which are not there:

MIB search path: /home/anon/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
Cannot find module (SNMPv2-SMI): At line 34 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt

I believe the packaged copies of those MIBs are in Debian’s non-free section, which would explain why a default install ignores them. I did not enable non-free for this test, so I have not verified that route. What you can do without it is put the MIB files you need in ~/.snmp/mibs (the first directory on the search path), and meanwhile work in numbers. A few you will use constantly:

OIDMeaning
.1.3.6.1.2.1.1.1.0sysDescr
.1.3.6.1.2.1.1.3.0sysUpTime
.1.3.6.1.2.1.1.5.0sysName
.1.3.6.1.2.1.2.2.1.2ifDescr (per interface)
.1.3.6.1.2.1.2.2.1.10ifInOctets
.1.3.6.1.2.1.2.2.1.16ifOutOctets

Two output flags help. -On always prints numeric OIDs with a leading dot, which is the form you paste into a monitoring system, and -Oqv prints only the value, which is what scripts want.

Reading the system group and interface counters

$ snmpwalk -v2c -c labro 10.70.0.1 .1.3.6.1.2.1.1
iso.3.6.1.2.1.1.1.0 = STRING: "Linux modern-tools 6.12.115+deb13.1-cloud-amd64 ..."
iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.8072.3.2.10
iso.3.6.1.2.1.1.3.0 = Timeticks: (10373) 0:01:43.73
iso.3.6.1.2.1.1.4.0 = STRING: "noc@example.net"
iso.3.6.1.2.1.1.5.0 = STRING: "modern-tools"
iso.3.6.1.2.1.1.6.0 = STRING: "Lab rack 1"

The walk continues into sysORTable (the list of supported MIB modules), which I trimmed. Two details worth noticing: sysObjectID (.1.3.6.1.4.1.8072.3.2.10) is Net-SNMP’s registered Linux identity, and sysName is the hostname while sysLocation and sysContact came from my config file.

For interfaces, walk ifDescr then read counters by index:

$ snmpwalk -v2c -c labro 10.70.0.1 .1.3.6.1.2.1.2.2.1.2
iso.3.6.1.2.1.2.2.1.2.1 = STRING: "lo"
iso.3.6.1.2.1.2.2.1.2.20 = STRING: "a0"

The final number is the ifIndex, here 20 and not 2. Always look the index up and never assume it. To prove the counter moves, I read ifInOctets.20, sent 50 pings of 1000 bytes, and read it again:

in octets: 10392 -> 61532

A difference of 51,140 octets, which is about 50 packets of roughly 1,000 bytes of payload plus headers. A rate is always two reads and a division by the time between them. These are Counter32 values that wrap around, which at 1 Gbit/s is every 34 seconds or so. On fast links use the 64-bit ifHCInOctets counters from the ifXTable instead.

SNMPv3

$ snmpget -v3 -l authPriv -u labuser -a SHA-256 -A "authpass-1234" \
    -x AES -X "privpass-1234" 10.70.0.1 .1.3.6.1.2.1.1.3.0
iso.3.6.1.2.1.1.3.0 = Timeticks: (10481) 0:01:44.81

The failures are more useful than the success, because each has its own message:

What I got wrongWhat the tool said
Wrong authentication passwordsnmpget: Authentication failure (incorrect password, community or key)
Unknown user namesnmpget: Unknown user name
Right user, security level noAuthNoPrivError in packet. Reason: authorizationError (access denied to that object)
Wrong v2c communityTimeout: No Response from 10.70.0.1.

The last row is the one that wastes time. From the manager, a wrong community string looks like a timeout. I did not test a source address outside the allowed network or a firewalled port, but I would expect them to look the same, because the agent has nothing to say to a request it rejects. v3 at least tells you when the problem is credentials. I did not test a wrong privacy password.

Seeing the difference on the wire

I captured port 161 while running one v2c and one v3 query:

IP 10.70.0.2.60050 > 10.70.0.1.161:  C="labro" GetRequest(28)  .1.3.6.1.2.1.1.6.0
IP 10.70.0.1.161 > 10.70.0.2.60050:  C="labro" GetResponse(38)  .1.3.6.1.2.1.1.6.0="Lab rack 1
IP 10.70.0.2.55556 > 10.70.0.1.161:  F=r U="" E= C="" GetRequest(14)
IP 10.70.0.1.161 > 10.70.0.2.55556:  F= U="" E=_80_00_1f_88_80_3c_99_22_6b_6a_f7_e8_6a_00_00_0
IP 10.70.0.2.55556 > 10.70.0.1.161:  F=apr U="labuser" [!scoped PDU]dd_99_0c_b9_a3_55_9d_64_83
IP 10.70.0.1.161 > 10.70.0.2.55556:  F=ap U="labuser" [!scoped PDU]01_01_fa_df_a6_a5_ae_e7_e6_

The v2c exchange shows the community string labro and the answer Lab rack 1 in clear text. Counting in the raw capture, labro appeared 4 times and Lab rack twice. The v3 exchange shows three round trips: engine discovery, then an encrypted request with the user name visible but the content not. The v3 answer (modern-tools) appeared zero times in the capture. That is the entire security argument for v3 in two numbers.

Traps

With snmptrapd listening on the manager:

authCommunity log,execute,net labtrap

I sent a linkDown trap from the agent side:

snmptrap -v2c -c labtrap 10.70.0.2:162 '' .1.3.6.1.6.3.1.1.5.3 \
  .1.3.6.1.2.1.2.2.1.1.20 i 20 .1.3.6.1.2.1.2.2.1.7.20 i 2 .1.3.6.1.2.1.2.2.1.8.20 i 2

and the receiver logged:

2026-11-02 20:52:14 <UNKNOWN> [UDP: [10.70.0.1]:52307->[10.70.0.2]:162]:
iso.3.6.1.2.1.1.3.0 = Timeticks: (605783) 1:40:57.83	iso.3.6.1.6.3.1.1.4.1.0 = OID: iso.3.6.1.6.3.1.1.5.3
iso.3.6.1.2.1.2.2.1.1.20 = INTEGER: 20	iso.3.6.1.2.1.2.2.1.7.20 = INTEGER: 2	iso.3.6.1.2.1.2.2.1.8.20 = INTEGER: 2

.1.3.6.1.6.3.1.1.5.3 is the standard linkDown notification, and the three varbinds are ifIndex, ifAdminStatus and ifOperStatus (2 meaning down). The host shows as <UNKNOWN>, because the sender’s address did not resolve to a name here. Without MIBs, the trap log is also numbers, and my snmptrapd log file started with dozens of “Cannot find module” lines before the trap itself. Filter the log with grep -v "Cannot" if you tail it.

Practical advice

  • Prefer v3 authPriv for anything you care about, and restrict v2c communities by source network when you cannot avoid them.
  • Use numeric OIDs in scripts. They do not depend on what MIBs the machine happens to have.
  • Debug in this order: can I reach UDP 161 (capture it), do credentials match, does the view allow that OID.
  • Use -Oqv for scripts and -On for configs.

SNMP’s reputation for being awkward comes mostly from MIB handling. Once you accept that numbers are the real interface and names are a convenience, the protocol is small and predictable.