Discussion:
snmpget on a broadcast address
Guru Prasad
2017-06-21 13:45:15 UTC
Permalink
Tried with snmpwalk on the broadcast address 192.168.1.25

snmpwalk -v2c -c public <192.168.1.25> 1.3.6.1.2.1.1.1.0

sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(161),
sin_addr=inet_addr("*192.168.1.25*")},
msg_iov(1)=[{"0)\2\1\1\4\6public\241\34\2\4\36;\4\337\2\1\0\2\1\0000\0160\f\6"...,
43}], msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 43
select(4, [3], NULL, NULL, {14, 999988}) = 1 (in [3], left {14, 999729})
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(161),
sin_addr=inet_addr("*192.168.1.16*")},
msg_iov(1)=[{"03\2\1\1\4\6public\242&\2\4\36;\4\337\2\1\0\2\1\0000\0300\26\6"...,
65536}], msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 53
getsockname(3, {sa_family=AF_INET, sin_port=htons(45826),
sin_addr=inet_addr("0.0.0.0")}, [16]) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(161),
sin_addr=inet_addr("*192.168.1.25*")},
msg_iov(1)=[{"0)\2\1\1\4\6public\240\34\2\4\36;\4\340\2\1\0\2\1\0000\0160\f\6"...,
43}], msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 43
select(4, [3], NULL, NULL, {14, 999995}) = 1 (in [3], left {14, 999991})
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(161),
sin_addr=inet_addr("*192.168.1.10*")},
msg_iov(1)=[{"03\2\1\1\4\6public\242&\2\4\36;\4\337\2\1\0\2\1\0000\0300\26\6"...,
65536}], msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 53
getsockname(3, {sa_family=AF_INET, sin_port=htons(45826),
sin_addr=inet_addr("0.0.0.0")}, [16]) = 0
select(4, [3], NULL, NULL, {14, 999681}) = 1 (in [3], left {14, 999677})
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(161),
sin_addr=inet_addr("*192.168.1.15*")},
msg_iov(1)=[{"03\2\1\1\4\6public\242&\2\4\36;\4\337\2\1\0\2\1\0000\0300\26\6"...,
65536}], msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 53
getsockname(3, {sa_family=AF_INET, sin_port=htons(45826),
sin_addr=inet_addr("0.0.0.0")}, [16]) = 0
select(4, [3], NULL, NULL, {14, 999480}) = 1 (in [3], left {14, 999477})
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(161),
sin_addr=inet_addr("*192.168.1.16*")},
msg_iov(1)=[{"0\201\200\2\1\1\4\6public\242s\2\4\36;\4\340\2\1\0\2\1\0000e0c"...,
65536}], msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 131
getsockname(3, {sa_family=AF_INET, sin_port=htons(45826),
sin_addr=inet_addr("0.0.0.0")}, [16]) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f8bc2197000
write(1, "SNMPv2-MIB::sysDescr.0 = STRING:"..., 121SNMPv2-MIB::sysDescr.0 =
STRING: *Linux debian-abhilash* 3.16.0-4-amd64 #1 SMP Debian
3.16.36-1+deb8u2 (2016-10-19) x86_64


From the above output we can see that, snmpwalk on broadcast ip
192.168.1.25, checks for the snmp agents in the following machines
192.168.1.16
192.168.1.10
192.168.1.15

But it prints the value "sysdescr" only for 192.168.1.16.

Please let me know what i am missing here.


Thanks
Guruprasad
Hi All,
Using netsnmp-5.7.3 in a debian machine.
I am trying to run snmpget on the network's broadcast address so as to get
all
the snmp agents in my network. But i could not get the response of the
snmp agents at once. It gives the information of one snmp agent at a time
snmpget -v2c -c public <192.168.1.25> 1.3.6.1.2.1.1.1.0
Actually i have two snmp agents in my network.
But getting only one agent's info at a time
SNMPv2-MIB::sysDescr.0 = STRING: Linux Debian-64 bit
Running the above snmpget command after few seconds gives
SNMPv2-MIB::sysDescr.0 = STRING: Linux Ubuntu-32 bit
But what i expect is
snmpget -v2c -c public <192.168.1.25> 1.3.6.1.2.1.1.1.0 should give the
following output
SNMPv2-MIB::sysDescr.0 = STRING: Linux Debian-64 bit (192.168.1.10)
SNMPv2-MIB::sysDescr.0 = STRING: Linux Ubuntu-32 bit (192.168.1.15)
Why snmpget is not giving the output of all snmp agents at once?
Thanks
Guruprasad
Bill Fenner
2017-06-27 14:59:33 UTC
Permalink
Hi All,
Using netsnmp-5.7.3 in a debian machine.
I am trying to run snmpget on the network's broadcast address so as to get
all
the snmp agents in my network. But i could not get the response of the
snmp agents at once. It gives the information of one snmp agent at a time
snmpget -v2c -c public <192.168.1.25> 1.3.6.1.2.1.1.1.0
Actually i have two snmp agents in my network.
But getting only one agent's info at a time
SNMPv2-MIB::sysDescr.0 = STRING: Linux Debian-64 bit
Running the above snmpget command after few seconds gives
SNMPv2-MIB::sysDescr.0 = STRING: Linux Ubuntu-32 bit
But what i expect is
snmpget -v2c -c public <192.168.1.25> 1.3.6.1.2.1.1.1.0 should give the
following output
SNMPv2-MIB::sysDescr.0 = STRING: Linux Debian-64 bit (192.168.1.10)
SNMPv2-MIB::sysDescr.0 = STRING: Linux Ubuntu-32 bit (192.168.1.15)
Why snmpget is not giving the output of all snmp agents at once?
snmpget is written to communicate with a single agent at once, and uses an
API that sends a single request and waits for a single reply. The handling
of responses to a broadcast request would have to be handled differently,
waiting to gather responses from multiple agents.

The feature request for this different program is here:
https://sourceforge.net/p/net-snmp/feature-requests/18/
An alternative that teaches snmpget about ranges to query is here:
https://sourceforge.net/p/net-snmp/patches/505/

Bill

Loading...