how do I get the MAC Address given the IP

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

Any ideas how can I get the MAC address of a PC outside my lan given the IP.
I tried using iphlpapi.dll to call sendARP but dosen't work for outside my
lan.

Thanks in advance
 
MMA said:
Hi All,

Any ideas how can I get the MAC address of a PC outside my lan given the IP.
I tried using iphlpapi.dll to call sendARP but dosen't work for outside my
lan.

Thanks in advance

Short answer is: You can't do that easily. Why would you need MAC address?

You could:
use WMI to connect to computer and obtain that data. It may not work
because of firewalls, security reasons etc...
Implement some service on the remote side which will provide that
information

Regards,
Goran
 
Hi Vadym,

Does WMI allows me to talk outside my LAN. My research seems to indicate no.
Any ideas.

Thanks in advance
 
Hello, MMA!

M> Does WMI allows me to talk outside my LAN. My research seems to indicate
M> no. Any ideas.

Then as Goran Sliskovic mentioned you have to implement some service that will give you
host's MAC address.
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
MMA said:
Hi All,

Any ideas how can I get the MAC address of a PC outside my lan given the IP.
I tried using iphlpapi.dll to call sendARP but dosen't work for outside my
lan.

Thanks in advance

What would you do with the MAC address? Aside from that, are you really
expecting to see the MAC address of the computer that's accessing your
site/app? Because if they're using NAT you won't get to that. Concider
the following:

pc(192.168.0.1)-->router(external ip: 10.10.1.1)-->| WEB/VPN/whatever
|-->your router-->your server/pc

Now your server will only see the 10.10.1.1 address so when you're
actually able to get the associated MAC address, you'll only get the MAC
address of the router, not the PC.

ps. I know 10.10.x.x is an internal range, I just used it for
demonstrational purposes ;)
 
Good point Rinze,

Something we have taken into account of, however because we are in somewhat
of a WAN, we are not most likely not going to be using NAT.

Thanks
 
Back
Top