Mailinglist Archive: opensuse (882 mails)

< Previous Next >
Re: [opensuse] How to find list of hosts on local subnet?
  • From: John Andersen <jsamyth@xxxxxxxxx>
  • Date: Fri, 03 Dec 2010 11:06:23 -0800
  • Message-id: <4CF93FAF.5030906@xxxxxxxxx>
On 12/3/2010 9:24 AM, Greg Freemyer wrote:
On Fri, Dec 3, 2010 at 10:04 AM, İsmail Dönmez <ismail@xxxxxxxxxxx> wrote:
On Fri, Dec 3, 2010 at 4:19 PM, James Wright <jamfwright@xxxxxxxxx> wrote:

I generally do something like this:

for host in 10.1.0.{1..254}; do fping $host; done

How about ping -b 255.255.255.255 ?

Regards,
ismail

I don't think you can trust pings of the broadcast IP.

================================
On my network:
Both
ping -b 255.255.255.255
and
ping -b 10.0.1.255

only show 5 hosts:

===
WARNING: pinging broadcast address
PING 10.0.1.255 (10.0.1.255) 56(84) bytes of data.
64 bytes from 10.0.1.249: icmp_seq=1 ttl=64 time=0.289 ms
64 bytes from 10.0.1.248: icmp_seq=1 ttl=255 time=0.311 ms (DUP!)
64 bytes from 10.0.1.183: icmp_seq=1 ttl=64 time=1.21 ms (DUP!)
64 bytes from 10.0.1.2: icmp_seq=1 ttl=64 time=1.22 ms (DUP!)
64 bytes from 10.0.1.3: icmp_seq=1 ttl=64 time=2.20 ms (DUP!)
===

But:
fping -g 10.0.1.0/24 -a -s -c 1 -r 1

Reports 24 IPs in use:
===
256 targets
24 alive
232 unreachable
===

which seems a lot more realistic in my office.

fyi: the broadcast ping is missing both openSUSE and windows machines
at a minimum. Seems to get routers and printers.

Greg


broadcast is only showing 5 machines.





Because of the dups, you can't rely on the output of pinging the
broadcast. That is why you have to follow it with an "arp -n"

Furthermore, you don't want to sent out a stream of pings to
broadcast, two is plenty to populate your arp table.

Pinging each host separately, per James's example requires evaluating
a rather messy return, and David was looking for something that
he could put in a script.




--
_____________________________________
---This space for rent---
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups