0

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

1

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:

[Unit]
Description=Simple Network Management Protocol (SNMP) Daemon.
After=syslog.target network.target

[Service]
Type=notify
Environment=OPTIONS="-LS0-6d"
EnvironmentFile=-/etc/sysconfig/snmpd
ExecStart=/usr/sbin/snmpd $OPTIONS -f
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Simply change that "ExecStart" line to contain what you'd like.

E.g.

ExecStart=/usr/sbin/snmpd $OPTIONS -f udp:127.0.0.1 udp:192.168.1.135:161 udp6:[::1]:161

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.

1

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.

# /usr/sbin/snmpd 127.0.0.1 192.168.1.1

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:

# /usr/sbin/snmpd .... udp:127.0.0.1 udp:192.168.1.135:161 udp6:[::1]:161
1
  • not the most elegant solution. :-D – John Greene Nov 4 '15 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.