LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-19-2005, 07:00 PM   #1
mcirsta
LQ Newbie
 
Registered: Apr 2005
Posts: 14

Rep: Reputation: 0
find IP from MAC


OK so here's my problem . I have a linux server running Debian and a custom compiled kernel in a network . I have the MAC
of a certain computer in the LAN and I need to find its IP .
How can I do this ?
 
Old 04-19-2005, 08:00 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I'm sure there are other ways to do this but since it is on your network, you could ping a range of ip addresses and arp the same range. Then match up the mac to ip.
You may also have success using nmap on the range of ip addresses....
nmap -sP 192.168.1/24

For example: I setup a loop to ping 10 addresses on a range of 192.168.1/24
Code:
#!/bin/bash

for ((i=1; i<=10; i++));do
ping -c 1 192.168.1.$i 2>&1 >/dev/null
arp -a 192.168.1.$i
done
 
Old 04-19-2005, 09:19 PM   #3
angrybeaver
Member
 
Registered: Aug 2004
Location: .au
Distribution: debian, BSD
Posts: 104

Rep: Reputation: 17
fping is pretty handy to :

fping -g 192.168.1.0/24 | arp -a | grep aa:bb:cc:dd:ee:ff
 
1 members found this post helpful.
Old 04-20-2005, 05:04 PM   #4
mcirsta
LQ Newbie
 
Registered: Apr 2005
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks ! Yeah this stuff could work . I think I'll use arping though to make sure I can ping even if some machines have a firewall .

Last edited by mcirsta; 04-20-2005 at 05:10 PM.
 
Old 04-16-2007, 02:40 PM   #5
epayen
LQ Newbie
 
Registered: Oct 2005
Posts: 2

Rep: Reputation: 0
Lightbulb

Dear friends thank you for your help... that were very usefull,
I wish to leave a batch, in the same way of the original:

vi a file and write this code:

for ((i=$4; i<=$5; i++));do
/bin/ping -c 1 12.5.$3.$i 2>&1 >/dev/null
/sbin/arp -a 12.5.$3.$i
done

Then save the file as findmac.sh (or as you want).
Change permissions: #chmode 777 findmac.sh

and run the batch:

#./findmac.sh 12 5 80 0 62

And with this you will get the MACs of the IPs from 12.5.80.0 to 12.5.80.62

With a more work you can enhance this batch so you can find all octets.
 
Old 06-16-2009, 03:06 PM   #6
nobler1050
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 0
I know this topic is old, but I ran into the same issue and found that running nmap as root instead of a general user gives you the MAC address from a standard scan. Example 'nmap 192.168.0.0/24' has the following output:

Interesting ports on 192.168.0.10:
Not shown: 1712 closed ports
PORT STATE SERVICE
443/tcp open https
1720/tcp open H.323/Q.931
MAC Address: 00:1A:E8:05:A6:01 (Siemens Enterprise Communications GmbH & Co. KG)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i find mac address compzoo Linux - Networking 3 02-03-2005 02:02 PM
how would you find the mac address bhupee Linux - Newbie 5 07-05-2004 06:07 PM
Is it possible to find an IP address from a MAC-adress? TheSpork Linux - Networking 1 06-30-2004 02:48 AM
how to find IP if I have MAC address bojo Linux - Networking 3 11-29-2003 10:10 PM
how to find out my MAC address gexiaofei Linux - Software 9 08-18-2003 12:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration