Get users Mac Address

Hi,

I need to be able to get a users Mac Address onto a web page that they can see.

I can get all users ip/mac info using the router api and ‘/ip/arp/print’ however I cannot see anyway to match one of those to the user’s local ip if the web site hosting the page is external to the network. I can only get the wan address.

I can’t see a way to get this using the router’s hotspot web server and I don’t want to have another web server inside the lan.

Is there any way to accomplish this? I’m sure this is simple and I’m just missing something.

Thanks in advance.

Kim

It will be easiest if the web server is within the local network. That way, you’ll know their actual IP when they connect.

But there actually IS another way, surprisingly (that I too only recently realized)… You can check the port that the remote device wants replies to, and then use the API to find it in “/ip/firewall/connection” menu, and the “reply-src-address” in particular. That same entry’s “src-address” will contain the IP of the user that made the original request, and bingo - you find THAT in “/ip/arp”.


(If you’re using PHP, you can find the remote port using $_SERVER[‘REMOTE_PORT’])

Hi,

Thanks for that, I gave that a try with a known ip however the port reported back from php isn’t the same as the port that shows up in ip/firewall/connections

I think the nat/pat setup on the router randomises the ports.

I tried a metarouter with openwrt on it, but was too unstable even without adding any packages.

I think I’ll get a raspberry pi board on the lan side with a lamp stack.

Kim