Search code examples
phpip-addressroutermac-address

Is it possible to find out a user's router's MAC address?


I would like to use a PHP script to find the router that a user is connected to my site from. Is this possible with PHP or some other Server-Side language?

I have looked online and it looks like its not possible to get if for the user's computer, but for the router? EDIT: I am only interested in the user's router, not the user's specific computer.


Solution

  • You can't find the destination user MAC because MAC is only usable in local network packet exchaning, in WAN network you use IP to packet exchanging then you can only get IP of her router.

    But is a exception from this rule, if you are with user in local network (eg. server is in local network) then you can get MAC address of client or router by look at ARP table, in her you have IP addresses of local computers and her MAC's, from this table you can get her router MAC by finding in ARP table Gateway IP association, because her gateway is a your gateway and gateway is a router in your network and her network too because you is in same network with client..

    But at all this is nonsense in this case because communication with user and server is a local, then packets will not reach the router, but if you really want this you can get this.

    Second nonsense is if you are in local network with user (only one option to solve this problem) then probably gateway address will be constant always. This can make change if someone change a router device to other.;-)

    Summary: You can solve this problem but only if server and user is in a local network, but i think you want solve this problem for WAN network, then you can't do this ... sorry is not me choice, live is brutal.