SNMP over the internet

Bryan CS asked:

Basically, I have a small network where my OpenNMS installation is located on a CentOS 6.4 machine.

Now I have a server(CentOS also) that I want to monitor but is on the internet, with a public address.

I have installed net-snmp on my target server and configured /etc/snmp/snmpd.conf

When I try to do

snmpwalk -v 2c -c public localhost

on my target system, it returns the expected output.

But running

snmpwalk -v 2c -c public c******2.com

on my OpenNMS server querying against my target server returns a

Timeout: No Response from c******2.com

I tried turning debug on (snmpwalk -v 2c -c public c****2.com -d) and I got this output:

Sending 42 bytes to UDP: [*.*.*.*]:161->[0.0.0.0]

I wonder what could be the problem?

Update:

This is my config inside snmpd.conf

##sec.name  source          community
com2sec local     localhost       private
com2sec national  x.x.x.x/23  public

##group.name sec.model  sec.name
group MyRWGroup  v2c        local
group MyROGroup  v2c        national

##incl/excl subtree                          mask
view all    included  .1                               80

## -or just the mib2 tree-

view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc


## context sec.model sec.level prefix read   write  notif
access MyROGroup ""      any       noauth    prefix      all    none   none
access MyRWGroup ""      any       noauth    prefix      all    all    all

disk PATH [MIN=100000]

disk / 10000

load 12 14 14

My answer:


Here is a problem: You haven’t actually allowed snmpd to respond to your connections.

com2sec national  x.x.x.x/23  public

You said that this IP address is the IP of the same server running snmpd, which means that only machines within that /23 will be allowed. This is almost certainly not what you want.

To resolve the issue, use the IP address of the machine(s) which will be sending the SNMP requests. If you have multiple IP addresses you will need multiple com2sec lines here. Or you can just use default and then use the firewall to control access.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.