16

I have configured SNMP Agent in my system with ip address 192.168.1.1 I have configured SNMP Agent in it using the following tutorial

I have modified the lines as follows

In the file /etc/snmp/snmpd.conf

 rocommunity public 127.0.0.1
 rocommunity public 192.168.1.0/24
 rocommunity public 192.168.2.0/24

In the file /etc/default/snmpd

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'

When I try to use the snmpwalk command from the system with ip address 192.168.1.1 it works fine.

Ex: A chunk of the commands output:

iso.3.6.1.2.1.1.1.0 = STRING: "Linux devenv 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64"
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: (74328) 0:12:23.28
iso.3.6.1.2.1.1.4.0 = STRING: "Me <me@example.org>"
iso.3.6.1.2.1.1.5.0 = STRING: "devenv"
iso.3.6.1.2.1.1.6.0 = STRING: "Sitting on the Dock of the Bay"
iso.3.6.1.2.1.1.7.0 = INTEGER: 72

But when I try to use snmpwalk through a different system with ip 192.168.2.1 it gives No response from 192.168.1.1. Please Help.

snmpwalk -c public -v1 192.168.1.1 | less

PS I have configured the same steps on the machine with ip address 192.168.2.1. Or is there any other program that will be used.

EDIT 1.

Did netstat here is a screenshot

Snmpd netstat

Tarun
  • 4,275
  • 15
  • 53
  • 74

3 Answers3

18

Edit the file /etc/snmp/snmpd.conf. Change the line:

agentAddress  udp:127.0.0.1:161

to:

agentAddress  udp:161

Then restart snmpd:

sudo service snmpd restart

It should listen to all interfaces now:

$ sudo netstat -ulnp | grep 161
udp        0      0 0.0.0.0:161             0.0.0.0:*                           8517/snmpd      
Eric Carvalho
  • 55,453
2

My solution

agentAddress udp:161
...
# rocommunity public  default    -V systemonly
rocommunity public 172.25.7.169/32

...and restart snmp

It makes snmp to hear in all interfaces but only answer to 172.25.7.169 (my monitor server)

-1

You could do something like this also, all combined here: agentAddress udp:172.16.0.3:161,udp6:[2001:470:0:4000::3]:161,udp6:[2001:470:0:10::3]:161