Search code examples
web-applicationslanmac-addressarp

Registering a device with an application based on MAC address


I am trying to build an application that runs on a local server, which can be accessed by smart phone devices connecting to it through a router (say placed at the security gates). It is an in-campus check-in/check-out local application, and not meant to be accessed by clients over the internet.

Now I want to register each smartphone device uniquely with the web-application so that there are no extra details to be fed in, or no login be required each time during check-in or check-out. And my approach would be to register each device based on its MAC address.

Will I be able to retrieve the MAC address of any device on the network connected to the application? I would prefer PHP.

exec('arp '.$_SERVER['REMOTE_ADDR'],$user_mac);

Will the arp command be able to retrieve addresses on this network? Also, are there better ways to identify devices uniquely, and permanently?

Thanks.


Solution

  • MAC addresses are not visible across segments, you need to have no routers between you and your client to be able to get its MAC address from ARP.