Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get an IP address from Mac address programmatically on Android?

Programmatically, I got Mac addresses of other Wifi enabled devices from my device on the same network. Same I need to apply here. Is there any apps or any other possibilities to get an IP addresses of each wifi enabled devices on the network by using those Mac addresses on Android?

like image 549
Achiever Avatar asked Aug 23 '12 11:08

Achiever


People also ask

How can I find the IP address from a MAC address?

Is it possible to find an IP address from a MAC address? Yes. To do so, you need to open a Command Prompt window and enter the command “arp -a”. That way you will get all of the IP addresses that are active on your network.

Can you ping a MAC address to get an IP?

You can use ARP to obtain an IP from a known MAC address. But first, it is important to update your local ARP table in order to get information from all devices in the network. Send a ping (ICMP echo reply) to the entire LAN, to get all the MAC entries on the table.

Can I track a device by its MAC address?

There isn't a way to find a stolen computer from the MAC address or to find the identity behind one of these addresses. Much like IP addresses, MAC addresses are assigned to network devices and are easy to determine with tools like Command Prompt.


2 Answers

If you're looking for an android app, you could try Network Discovery which work very well and can list all the devices on your local network with the corresponding IP and address.

If you're looking for code instead, well the application is available on github and does (amongst other things ) basically the same thing than explained by Yahel : it reads /proc/net/arp .

Note : I'm NOT the author of this application.

like image 197
Pierre Rust Avatar answered Nov 15 '22 05:11

Pierre Rust


This person does the exact opposite so it should work for you.

The trick is to read the ARP cache table from the device.

http://www.flattermann.net/2011/02/android-howto-find-the-hardware-mac-address-of-a-remote-host/

like image 45
Yahel Avatar answered Nov 15 '22 06:11

Yahel