I know I *could* write a script to call "arp-scan -l" and process the output to show me the names of hosts on my LAN but it feels as if there should be an easier way.
So, is there a command that scans for and lists hosts by *name* on a LAN?
On Mon, 5 Nov 2012 18:08:06 +0000 Chris Green cl@isbd.net allegedly wrote:
So, is there a command that scans for and lists hosts by *name* on a LAN?
cat /etc/hosts
(sorry, couldn't resist it.)
Mick
---------------------------------------------------------------------
blog: baldric.net gpg fingerprint: FC23 3338 F664 5E66 876B 72C0 0A1F E60B 5BAD D312
---------------------------------------------------------------------
On Mon, Nov 05, 2012 at 06:18:07PM +0000, mick wrote:
On Mon, 5 Nov 2012 18:08:06 +0000 Chris Green cl@isbd.net allegedly wrote:
So, is there a command that scans for and lists hosts by *name* on a LAN?
cat /etc/hosts
Not when my hosts are assigned their IP addresses by a local DHCP server:-
root@chris:/etc/init.d# cat /etc/hosts 127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
... but:-
root@chris:/etc/init.d# arp-scan -l Interface: eth0, datalink type: EN10MB (Ethernet) Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/) 192.168.1.1 00:50:7f:8b:35:40 DrayTek Corp. 192.168.1.2 00:01:6c:6c:c7:9b FOXCONN 192.168.1.6 00:04:4b:07:13:30 NVIDIA 192.168.1.90 00:90:a9:70:06:ff WESTERN DIGITAL 192.168.1.113 50:fa:ab:00:51:8b L-tek d.o.o. 192.168.1.122 78:ac:c0:63:90:d4 Hewlett Packard 192.168.1.128 b8:27:eb:22:d7:92 (Unknown) 192.168.1.81 00:01:e3:9d:8b:b5 Siemens AG 192.168.1.140 00:23:8b:de:b6:d9 Quanta Computer Inc. 192.168.1.150 00:04:20:26:55:19 Slim Devices, Inc.
10 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.8.1: 256 hosts scanned in 1.416 seconds (180.79 hosts/sec). 10 responded
On Tue, 6 Nov 2012, Chris Green wrote:
Not when my hosts are assigned their IP addresses by a local DHCP server:-
root@chris:/etc/init.d# arp-scan -l Interface: eth0, datalink type: EN10MB (Ethernet) Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/) 192.168.1.1 00:50:7f:8b:35:40 DrayTek Corp. 192.168.1.2 00:01:6c:6c:c7:9b FOXCONN 192.168.1.6 00:04:4b:07:13:30 NVIDIA 192.168.1.90 00:90:a9:70:06:ff WESTERN DIGITAL 192.168.1.113 50:fa:ab:00:51:8b L-tek d.o.o. 192.168.1.122 78:ac:c0:63:90:d4 Hewlett Packard 192.168.1.128 b8:27:eb:22:d7:92 (Unknown) 192.168.1.81 00:01:e3:9d:8b:b5 Siemens AG 192.168.1.140 00:23:8b:de:b6:d9 Quanta Computer Inc. 192.168.1.150 00:04:20:26:55:19 Slim Devices, Inc.
Could you pipe this arp-scan -l output to something like this Perl script...?
#!/usr/bin/perl
my $line ; my @words ;
while ($line = <STDIN>) {
@words = split(/\s+/,$line) ;
if ($words[1] =~ /\d+.\d+.\d+.\d+/) { system("dig -x " . $words[1]) ; }
}
On Tue, 6 Nov 2012 16:16:20 +0000 Chris Green cl@isbd.net allegedly wrote:
On Mon, Nov 05, 2012 at 06:18:07PM +0000, mick wrote:
On Mon, 5 Nov 2012 18:08:06 +0000 Chris Green cl@isbd.net allegedly wrote:
So, is there a command that scans for and lists hosts by *name* on a LAN?
cat /etc/hosts
Not when my hosts are assigned their IP addresses by a local DHCP server:-
Chris
My response was tongue in cheek. But since I know that you use DNSmasq on your network and DNSmasq can consult a local hosts file before allocating IP addresses over DHCP (and can map specific MAC addresses to IP addresses according to the contents of /etc/ethers) it is perfectly reasonable to consult /etc/hosts.......
Mick
---------------------------------------------------------------------
blog: baldric.net gpg fingerprint: FC23 3338 F664 5E66 876B 72C0 0A1F E60B 5BAD D312
---------------------------------------------------------------------
On Tue, Nov 06, 2012 at 05:12:05PM +0000, mick wrote:
On Tue, 6 Nov 2012 16:16:20 +0000 Chris Green cl@isbd.net allegedly wrote:
On Mon, Nov 05, 2012 at 06:18:07PM +0000, mick wrote:
On Mon, 5 Nov 2012 18:08:06 +0000 Chris Green cl@isbd.net allegedly wrote:
So, is there a command that scans for and lists hosts by *name* on a LAN?
cat /etc/hosts
Not when my hosts are assigned their IP addresses by a local DHCP server:-
Chris
My response was tongue in cheek. But since I know that you use DNSmasq on your network and DNSmasq can consult a local hosts file before allocating IP addresses over DHCP (and can map specific MAC addresses to IP addresses according to the contents of /etc/ethers) it is perfectly reasonable to consult /etc/hosts.......
Yes, I sort of know your comment was tongue in cheek, but I thought I'd clarify what I was asking for anyway.
On Mon, 5 Nov 2012 18:08:06 +0000, cl@isbd.net said:
So, is there a command that scans for and lists hosts by *name* on a LAN?
quick 'n' dirty:
for a in $(arp-scan -l --interface=br0|awk '{print $1}'|grep ^[0-9]); do dig -x $a +short; done