MAC Address Detection – How to Detect Known MAC Address on .local and Get IP

ipip-link-localmac address

I would like to make a presence detection application which would be able to detect when a known device connects to the local Wifi network.
So basically I would know the MAC address of the device, but the IP is dynamically assigned so it can change.

I can only rely on the known MAC to determine if the device is here or not, how can I do that ?

I have thought about one possibility :

  • do a broadcast ping on my network (ping the 255 possibly IPs).

  • then do a arp request and look into the ARP table and try to find the
    known MAC

  • if I find it, the device is here and I can see the IP, if the
    MAC is not there then the device is not on the network

This could possibly work but it is not smart and requiers a permanent ping broadcast which can be slow in some cases according to my experiments. And it would not be energy efficient as well.

I am from Electrical Engineering and don't have a huge background into networks, so please pardon my maybe dumb question.
Hope somebody will be wiling to help me 🙂

Thank you.

Best Answer

Filter the output of tcpdump by MAC address:
sudo tcpdump ether host A1:B2:C3:D4:E5:F6
Add other options as needed.