SNMPD(8)
SNMPD(8) ๐ the Net-SNMP agent daemon, bestie
okay so you opened the Net-SNMP section-8 page for snmpd and you're like "what is this little guy" โ don't worry, I got you. grab a strawberry ๐, we're doing this.
โจ NAME โจ
snmpd โ daemon to respond to SNMP request packets.
โจ SYNOPSIS โจ
snmpd [OPTIONS] [LISTENING ADDRESSES]
โจ DESCRIPTION โจ
So snmpd is an SNMP agent ๐
it binds to a port and justโฆ waits. patiently. main character energy, honestly. when some SNMP management software shows up with a request, it processes the request(s), collects the info you asked for and/or performs the operation(s) you asked for, and sends the info right back to whoever asked. it's giving "customer service but make it a daemon." ๐ซถ
๐ธ OPTIONS ๐ธ
every single one, no skips, periodt:
-aโ log the source addresses of incoming requests. know who's knocking. ๐-Aโ append to the log file instead of truncating it. your history stays, bestie. no deleting the receipts. ๐-cFILE โ read FILE as a configuration file (or a comma-separated list of configuration files). heads up though: the loaded file will only understandsnmpd.conftokens, unless the configuration type is specified in the file as described in thesnmp_configman page under SWITCHING CONFIGURATION TYPES IN MID-FILE. iykyk.-Cโ do not read any configuration files except the ones optionally specified by the-coption. and note that this behaviour also covers the persistent configuration files ๐ญ which may result in dynamically-assigned values being reset following an agent restart, unless the relevant persistent config files are explicitly loaded using the-coption. so likeโฆ choose wisely.-dโ dump (in hexadecimal) the sent and received SNMP packets. hex girl summer. ๐ฅ-D[TOKEN[,...]]โ turn on debugging output for the given TOKEN(s). without any tokens specified, it defaults to printing all the tokens (which is equivalent to the keyword"ALL"). you might want to tryALLfor extremely verbose output. Note: you can not put a space between the-Dflag and the listed TOKENs. not one. not even a little one. ๐-fโ do notfork()from the calling shell. stay put, diva. ๐-gGID โ change the group ID of thesnmpdprocess into GID after opening listening sockets. this overrides theagentgroupconfiguration file parameter.-h,--helpโ display a brief usage message and then exit. lil help, then bye. ๐-Hโ display a list of configuration file directives understood by the agent and then exit.-I[-]INITLIST โ specifies which modules should (or should not) be initialized when the agent starts up. if the comma-separated INITLIST is preceded with a-, it is the list of modules that should not be started. otherwise this is the list of the only modules that should be started.- to get a list of compiled modules, run the agent with the arguments
-Dmib_init -H(assuming debugging support has been compiled in). ๐
- to get a list of compiled modules, run the agent with the arguments
-L[eEfFoOsSnN]โ specify where logging output should be directed (standard error or output, to a file or via syslog). see LOGGING OPTIONS insnmpcmd(1)for details.-mMIBLIST โ specifies a colon separated list of MIB modules to load for this application. this overrides the environment variableMIBS. seesnmpcmd(1)for details.-MDIRLIST โ specifies a colon separated list of directories to search for MIBs. this overrides the environment variableMIBDIRS. seesnmpcmd(1)for details.-nNAME โ set an alternative application name (which will affect the configuration files loaded). by default this will besnmpd, regardless of the name of the actual binary. glow-up name change, but make it config. โจ-pFILE โ save the process ID of the daemon in FILE.-qโ print simpler output for easier automated parsing. lowercase, low-effort, very demure. ๐-rโ do not require root access to run the daemon. specifically, do not exit if files only accessible to root (such as/dev/kmemetc.) cannot be opened. permission slip: denied, but we're still going. ๐ฆ-uUID โ change the user ID of thesnmpdprocess into UID (which can be given in numerical or textual form) after opening listening sockets. this overrides theagentuserconfiguration file parameter.-Uโ instructs the agent to not remove its pid file (see the-poption) on shutdown. overrides theleave_pidfiletoken in thesnmpd.conffile, seesnmpd.conf(5).-v,--versionโ print version information for the agent and then exit.-Vโ symbolically dump SNMP transactions. symbolically. ๐ซ-xADDRESS โ listens for AgentX connections on the specified address rather than the default"/var/agentx/master". the address can either be a Unix domain socket path, or the address of a network interface. the format is the same as the format of listening addresses described below.-Xโ run as an AgentX subagent rather than as an SNMP master agent. supporting role, still iconic. ๐--name="value"โ allows one to specify any token ("name") supported in thesnmpd.conffile and sets its value to"value". overrides the corresponding token in thesnmpd.conffile. seesnmpd.conf(5)for the full list of tokens.
๐ฆ LISTENING ADDRESSES ๐ฆ
by default, snmpd listens for incoming SNMP requests on UDP port 161 on all IPv4 interfaces. but bestie, you can absolutely modify this behaviour by specifying one or more listening addresses as arguments to snmpd. a listening address takes the form:
[<transport-specifier>:]<transport-address>
at its simplest, a listening address may consist only of a port number, in which case snmpd listens on that UDP port on all IPv4 interfaces. otherwise, the <transport-address> part of the specification is parsed according to this lil lineup:
udp(default) โhostname[:port]orIPv4-address[:port]tcpโhostname[:port]orIPv4-address[:port]unixโpathnameipxโ[network]:node[/port]aal5pvcorpvcโ[interface.][VPI.]VCIudp6orudpv6orudpipv6โhostname[:port]orIPv6-address[:port]tcp6ortcpv6ortcpipv6โhostname[:port]orIPv6-address[:port]sshโhostname:portdtlsudpโhostname:port
note that <transport-specifier> strings are case-insensitive so that, for example, "tcp" and "TCP" are equivalent. ๐
here are some examples, along with their interpretation:
127.0.0.1:161โ listen on UDP port161, but only on the loopback interface. this preventssnmpdbeing queried remotely. the port specification":161"is not strictly necessary since that is the default SNMP port. private vibes only. ๐TCP:1161โ listen on TCP port1161on all IPv4 interfaces.ipx:/40000โ listen on IPX port40000on all IPX interfaces.unix:/tmp/local-agentโ listen on the Unix domain socket/tmp/local-agent./tmp/local-agentโ is identical to the previous specification, since the Unix domain is assumed if the first character of the<transport-address>is/.PVC:161โ listen on the AAL5 permanent virtual circuit withVPI=0andVCI=161(decimal) on the first ATM adapter in the machine.udp6:10161โ listen on port10161on all IPv6 interfaces.ssh:127.0.0.1:22โ allows connections from the snmp subsystem on the ssh server on port22. the details of using SNMP over SSH are defined below. ๐งdtlsudp:127.0.0.1:9161โ listen for connections over DTLS on UDP port9161. thesnmp.conffile must have theserverCert, configuration tokens defined.
โ ๏ธ note that not all the transport domains listed above will always be available; for instance, hosts with no IPv6 support will not be able to useudp6transport addresses, and attempts to do so will result in the error"Error opening specified endpoint". likewise, since AAL5 PVC support is only currently available on Linux, it will fail with the same error on other platforms. it's not you, it's the platform. ๐ญ
๐ Transport Specific Notes ๐
ssh
the SSH transport, on the server side, is actually just a unix named pipe that can be connected to via a ssh subsystem configured in the main ssh server. the pipe location (configurable with the sshtosnmpsocket token in snmp.conf) is /var/lib/net-snmp/sshdomainsocket. packets should be submitted to it via the sshtosnmp application, which also sends the user ID as well when starting the connection. the TSM security model should be used when packets should process it.
the sshtosnmp command knows how to connect to this pipe and talk to it. it should be configured in the OpenSSH sshd configuration file (which is normally /etc/ssh/sshd_config) using the following configuration line:
Subsystem snmp /usr/local/bin/sshtosnmp /var/lib/net-snmp/sshdomainsocket
the sshtosnmp command will need read/write access to the /var/lib/net-snmp/sshdomainsocket pipe. although it should be fairly safe to grant access to the average user since it still requires modifications to the ACM settings before the user can perform operations, paranoid administrators may want to make the /var/lib/net-snmp directory accessible only by users in a particular group. use the sshtosnmpsocketperms snmp.conf configure option to set the permissions, owner and group of the created socket.
access control can be granted to the user "foo" using the following style of simple snmpd.conf settings:
rouser -s tsm foo authpriv
note that "authpriv" is acceptable assuming as SSH protects everything that way (assuming you have a non-insane setup). snmpd has no notion of how SSH has actually protected a packet and thus the snmp agent assumes all packets passed through the SSH transport have been protected at the authpriv level. trust but verify, except it literally can't verify, so it just trusts. ๐
dtlsudp
the DTLS protocol, which is based off of TLS, requires both client and server certificates to establish the connection and authenticate both sides. in order to do this, the client will need to configure the snmp.conf file with the clientCert configuration tokens. the server will need to configure the snmp.conf file with the serverCert configuration tokens defined. mutual, as it should be. ๐
access control setup is similar to the ssh transport as the TSM security model should be used to protect the packet.
๐ธ CONFIGURATION FILES ๐ธ
okay bestie, so snmpd goes looking for these files, and if they're there, it parses them. every single one, here's the whole lineup:
/etc/snmp/snmp.confโ the shared config for the agent and the applications. wanna know more?snmp.conf(5), it's all there, go read it ๐ซถ/etc/snmp/snmpd.conf/etc/snmp/snmpd.local.confโ agent-specific configuration, and yup,snmpd.conf(5)has the deets. these two files are optional, but lowkey they're where you set up access control, trap generation, subagent protocols, and honestly a whole bunch of other stuff too. the way that one file can do so much?? iconic.
and heads up โ beyond those two files sitting in /etc/snmp, the agent is also gonna read any file named snmpd.conf and any file named snmpd.local.conf that it finds along a colon separated path that you give it in the SNMPCONFPATH environment variable. so like, a:b:c style. yes really. it just goes down the line and reads them all ๐
/usr/share/snmp/mibs/โ the agent also loads every file in this directory as MIBs. but bestie, two things it will NOT do:- it will not load any file that begins with a
. - it will not descend into subdirectories
- it will not load any file that begins with a
periodt, that's the rule ๐
โจ SEE ALSO โจ
presented in the recommended reading order, because we're organized like that:
go forth and read, bestie, you got this ๐๐
and that's a wrap onSNMPD(8), fr fr ๐ฆ this page is from versionV5.9.5.2, dated30 Jun 2010, so it's giving vintage but the knowledge is timeless, no cap. slay, go configure something beautiful ๐๐ธ
๐ฆ where this page comes from
- alpine 3.23: net-snmp-doc 5.9.5.2-r0 ยท Net-SNMP
- alpine 3.24: net-snmp-doc 5.9.5.2-r0 ยท Net-SNMP
- fedora 44: net-snmp 1:5.9.5.2-4.fc44 ยท MIT-CMU AND BSD-3-Clause AND MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms