IP address from MAC


#1

I want to obtain the IP address of a network device based on its MAC address. Along the lines of the Linux ARP command (arp -a). I have the MAC address of the device, but need the IP address.

Is it possible to do this? How?

Thanks!


#2

It is possible if you are on the same subnet (or have access to the DHCP server for the subnet). If you are on another subnet than the node, isolated by one or more routers its not possible since the mac address is only used on the local subnet.

There is no way to query “which IP has this mac address” but you can ping the broacast address, for instance if your network is 192.168.1.0/24 then you can

ping 192.168.1.255

and then use

arp -a

to list the mac adresses of all the nodes on the subnet.


#3

You can use an IP scanner - something like “IP Scanner” or “IP Scanner Home” to discover which devices are on a specific WLAN.


#4

Yes, I know. But I need a dynamic solution because the IP addresses may change, as happened recently when I needed to restart my DHCP server. I know the MAC address of the device I want to communicate with, so I need a method to determine the IP address of that device dynamically.


#5

Why not set it as a static IP address?


#6

I can not set this device up with a static IP address. It’s a commercial device and it won’t let me.


#7

So this isn’t a Particle device? What kind of device is it? You may want to consult with the appropriate manufacturer’s configuration or use case documentation.


#8

It’s a music streamer. No fixed IP address possible.


#9

Although it looks like your problem is not with a Particle device, if you have access to the dhcp server, and previous know the MAC, we can just parse the dhcpd file that holds the valid leases (probably locate somewhere like /etc/dhcpd/interface_name)


#10

That approach is similar to using arp. But unfortunately I don’t have access to the dhcp file.