Mailinglist Archive: opensuse (882 mails)

< Previous Next >
Re: [opensuse] How to find list of hosts on local subnet? [Part Solved]
  • From: John Andersen <jsamyth@xxxxxxxxx>
  • Date: Thu, 02 Dec 2010 17:00:29 -0800
  • Message-id: <4CF8412D.2010408@xxxxxxxxx>
On 12/2/2010 4:51 PM, David C. Rankin wrote:
On 12/02/2010 06:43 PM, David C. Rankin wrote:
On 12/02/2010 06:15 PM, John Andersen wrote:
I use my Nexus One. Use to use my iPhone. Lots of apps for that.

When no tools at hand:
ping -c 2 -b <broadcast IP> (something like 192.168.1.255 - You need
-b option)
-c 2 sends just two pings. No need to get crazy.

then immediatly do

/sbin/arp -n

<snip>

I've noticed that using arpd seems to give you the best results for hosts that
might not be up at the moment. Just start arpd with:

# arpd -b /var/lib/arpwatch/arpd.db ath0

Here is the differences in the results. With arp I get only 4 hosts and the
router (.13)

18:45 alchemy:~/scr/utl/tst> ping -c2 -b 192.168.6.102
<snip>

18:45 alchemy:~/scr/utl/tst> sudo arp -n
Address HWtype HWaddress Flags Mask
Iface
192.168.6.121 ether 00:0F:1F:D6:03:A0 C
ath0
192.168.6.13 ether 00:23:69:5C:FD:B4 C
ath0
192.168.6.17 ether 00:E0:81:55:4E:1D C
ath0
192.168.6.147 ether 00:11:43:22:5A:25 C
ath0
192.168.6.14 ether 00:21:85:1A:8C:FA C
ath0

Using the script above, I get the whole list:

18:46 alchemy:~/scr/utl/tst> sh arpt.sh

Hostname IP Mac
archangel 192.168.6.14 00:21:85:1a:8c:fa
zachrys-iPhone 192.168.6.112 d4:9a:20:92:0b:f5
gateway (Linksys) 192.168.7.13 00:06:25:5e:dd:29
supersff 192.168.6.121 00:0f:1f:d6:03:a0
gw 192.168.6.13 00:23:69:5c:fd:b4
mail 192.168.6.17 00:e0:81:55:4e:1d
dcrgx2 192.168.6.147 00:11:43:22:5a:25
dcrgx 192.168.6.111 00:11:43:22:4f:23
zion 192.168.6.19 00:0c:76:13:16:e6
Wii 192.168.6.115 00:1b:ea:d6:91:80
ripper 192.168.6.149 00:0c:76:13:90:c2



Yup.

The distro I first used this on predated arpd (or at least It wasn't installed).
Nothing is going to find a host that is unpowered, which is why arpd is cool
because
it will record for you even if they only show up fleetingly, but of course you
have
to have it running, which most networks probably don't.

The ping command I use serves to fill in the arp table, but in real busy
networks
this info becomes stale and is dropped from the arp table fairly quickly.
You don't want to dawdle firing off that arp command after the ping.

The advantage is it works for non-root (unless someone hides arp) and it works
on
windows too.


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

< Previous Next >