Re: find IP address of device on network based on MAC address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]





Brian Mathis wrote:
On Dec 14, 2007 4:11 PM, Milton Calnek <milton@xxxxxxxxxx> wrote:
Brian wrote:
On Dec 14, 2007, at 3:21 PM, Les Mikesell wrote:

Jerry Geis wrote:
I have a device on my network that is not DHCP and I dont know the IP
address of it
and it has not method of finding it or changing it unless you know
the IP address (setable by browser).
Is there a way on linux, based on MAC address, to get the IP of the
unit?
You accumulate a table of mac<->ip assocations, but only after
communicating with something.  arp -a will show the current entries
(which expire fairly quickly).  You might ping everything in the
network range, then look for the mac in the arp list.
to ping every address, check out broadcast pings here

http://www.macworld.com/article/53277/2006/10/pingfind.html
(or google other how-to's)
The tool you want is fping.  It's available from the rpmforge repository.

fping -ga 192.168.c.d/m
arp -n | grep aa:bb:cc:dd:ee:ff

Now you may have two problems:
1. The unknown device is not in your address space. ie: your net is
192.168.0.0/24 and the ip of the device is 192.168.1.1.
2. Your mask is too large. ie: 192.168.0.0/20 may be too large for you
to scan the entire address space before your arp tables runs out of room.

Good luck.

--
Milton Calnek BSc, A/Slt(Ret.)


You can sacrifice a little bit of speed (this is not parallel) at the
advantage of not having to install another package by doing something
like this (using bash):

for ((i=1; i<=254; i+=1))
    do ping -c 5 192.168.1.$i
done

OR

for ((i=1; i<=254; i+=1))
    do for ((j=1; j<=254; j+=1))
        ping -c 5 192.168.$i.$j
    done
done

You sacrifice a lot of speed. To the point where if you do your arp after all the pings have finished, some of the arp entries at the lower end will have been deleted based on time when working with one class C.

If you want to do it that way try:
ping -c 3 192.168.$i.$j; arp -n | grep aa:bb:cc:dd:ee:ff

Also seq is much easier to use...
for i in `seq 0 255`; do



You can probably get parallel by adding an "&" to the end of the ping line
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


--
Milton Calnek BSc, A/Slt(Ret.)
milton@xxxxxxxxxx
306-717-8737


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux