Is it possible to resolve a MAC address to an IP address?


#1

I have some dynamic IP's (and Id rather not change that!).
But nonetheless I'd like to send http requests to the device.

Also while I'm at it , I don't suppose it's possible to set a timeout on the httpGet / asyncHttpGet .. the current setting is about 30 seconds, I'd like shorter


#2

So, the answer is likely to be "its difficult" .. web searches suggest using ARP, which really isn't going to fly in the groovy world of Hubitat.


#3

Why not reserve addresses for those devices in your router (or modem/router combo) to always have the router assign the same IP address to those devices. You don't need to cancel dynamic IP addresses for other devices that don't need to go to a static IP address for every device. Reserving the IP address just means that the particular device will always be assigned the same IP address. I use it for the Hubitat hub, my main computers, my printer, and my Iris V1 cameras as I need them to have an address that is stable while allowing the random addressing for other devices such as laptops that don't need such stability.


#4

ARP cache.


#5

Or DNS names? Why use IPs at all?


#6

How would one use DNS names in a home where devices don't have names to resolve?


#7

In my Asus router, when I use the DHCP Reservation feature I also assign a name. I can then use that name to access that machin on my home network. My DNS server for all of my systems is set to my Asus Router. If it can resolve the name locally, it does. Otherwise it send the DNS request to my ISP's DNS server.


#8

Yes, but most people don't do that, nor would most want to even if their router supported it.

Obviously that is an answer to the "how", but not an answer to the "why bother" above. :smile:


#9

If you are using LAN calls from the device to Hubitat, the IP and MAC address of the device making the call to the hub is passed to the parse() function. If you can have your device make a periodic "check-in" call to the hub, that will keep the addresses up to date and ensure that it's always reachable.


#10

You can't resolve a MAC address to a IP -- the MAC address only contains the Manufacturers ID and Product.

But.... you can use nmap too find which IP a MAC address it's using.

nmap -sP 192.168.0.1/24

That scans the entire 192.168.0.1 - 192.168.0.255

Example

# nmap -Pn 192.168.0.31

Starting Nmap 7.40 ( https://nmap.org ) at 2019-04-11 12:32 PDT
Stats: 0:00:00 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan
ARP Ping Scan Timing: About 100.00% done; ETC: 12:32 (0:00:00 remaining)
Nmap scan report for 192.168.0.31
Host is up (0.00070s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
80/tcp   open  http
443/tcp  open  https
8080/tcp open  http-proxy
MAC Address: 00:17:88:29:80:3F (Philips Lighting BV)

#11

Sure you can. That's the whole purpose of ARP. That's what Nmap's using under the hood.


#12

Yes I know but if it was that obvious the OP wouldn't be here asking this question.

So I gave a layman's explanation which is still correct.


#13

And if you know the MAC address you can also do this to determine the device that's using it.

nmap -sP 192.168.0.1/24 |grep 00:17:88:29:80:3F

MAC Address: 00:17:88:29:80:3F (Philips Lighting BV)

There are a few ways to figure out the device that's using the MAC address.


#14

I'll show my age here and confess that I used to administer a network of diskless Sun workstations. I used RARP (Reverse Address Resolution Protocol) to enable a system that was booting up to find its IP address based on the only thing it knew for sure at boot time: its MAC address.

The tools for doing this are still around, and part of many Linux distributions. There's a daemon that supports RARP, called rarpd. See: Ubuntu Manpage: rarpd - Reverse Address Resolution Protocol (RARP) daemon

So here's another way to determine a hosts IP address from its MAC address. I don't think this helps the OP, as rarpd requires a static database of MAC to IP mappings. Just historic musing...

Carry on.