I have this monitoring network setting for Net-SNMP 5.7.2.1 listening to multiple Ethernet interfaces on my home gateway but it would only take the following combination from the snmpd.conf configuration file:
- single IP address
- single IP address, protocol-specific
- single IP address per unique protocol
such as:
agentAddress 127.0.0.1:161
or
agentAddress udp:127.0.0.1:161
or
agentAddress udp:127.0.0.1:161,udp6:[::1],tcp:127.0.0.1:161
But it would not accept multiple IP addresses using the same protocol, as given below as desired:
agentAddress udp:127.0.0.1:161,udp:172.28.130.1:161
How do I make SNMP daemon (snmpd) listen to TWO (or more) Ethernet interfaces
After digging through NetSNMP code a bit, it looks like it processes the config file line-by-line, and appends to the agent address data if it finds something.
Thus, you are able to add multiple lines in the config file with multiple agent addresses:
I was able to test this on my own agent built with NetSNMP...
Apparently, the only way to specify multiple interfaces for version Net-SNMP 5.7.2.1 is by specifying multiple IP addresses at the command line for snmpd.
I've yet to find a workable solution of specifying multiple interfaces using the snmpd configuration (snmpd.conf) file approach.
It is there (at the command line) that you can specify the protocol granularity (and continue to use the same protocol across multiple interfaces) like this:
I'd suggest that you can modify the systemd script rather than doing it manually on the command line.
For example, the current snmpd.service located in /usr/lib/systemd/system/ contains the following:
Simply change that "ExecStart" line to contain what you'd like.
E.g.
NB: I've not tested this format, it may need to be around a different way with "-f" at the end or something - test and adjust. It stands to reason that it should work and then you have all the advantages of using systemd (which is being used anyway).
This platform snippet was from CentOS 7.3 so the location of snmpd.service may vary by distro. Find yours, make a copy of it to a .bak file and modify the original - test - enjoy.