Connecting Tech Pros Worldwide Forums | Help | Site Map

how do I get the MAC Address given the IP

MMA
Guest
 
Posts: n/a
#1: Aug 11 '06
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


Vadym Stetsyak
Guest
 
Posts: n/a
#2: Aug 11 '06

re: how do I get the MAC Address given the IP


Hello, MMA!

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

You can use WMI
To connect to another computer, see example
( http://msdn2.microsoft.com/en-us/lib...mentscope.aspx )
To query for MAC address
( http://www.eggheadcafe.com/articles/20030511.asp )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Goran Sliskovic
Guest
 
Posts: n/a
#3: Aug 11 '06

re: how do I get the MAC Address given the IP


MMA wrote:
Quote:
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

MMA
Guest
 
Posts: n/a
#4: Aug 11 '06

re: how do I get the MAC Address given the IP


Hi Vadym,

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

Thanks in advance

"Vadym Stetsyak" wrote:
Quote:
Hello, MMA!
>
MAny ideas how can I get the MAC address of a PC outside my lan given the
MIP. I tried using iphlpapi.dll to call sendARP but dosen't work for
Moutside my lan.
>
You can use WMI
To connect to another computer, see example
( http://msdn2.microsoft.com/en-us/lib...mentscope.aspx )
To query for MAC address
( http://www.eggheadcafe.com/articles/20030511.asp )
>
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot
Vadym Stetsyak
Guest
 
Posts: n/a
#5: Aug 11 '06

re: how do I get the MAC Address given the IP


Hello, MMA!

MDoes WMI allows me to talk outside my LAN. My research seems to indicate
Mno. 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
C-Services Holland b.v.
Guest
 
Posts: n/a
#6: Aug 15 '06

re: how do I get the MAC Address given the IP


MMA wrote:
Quote:
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 ;)
--
Rinze van Huizen
C-Services Holland b.v
MMA
Guest
 
Posts: n/a
#7: Aug 15 '06

re: how do I get the MAC Address given the IP


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


"C-Services Holland b.v." wrote:
Quote:
MMA wrote:
>
Quote:
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 ;)
--
Rinze van Huizen
C-Services Holland b.v
>
Closed Thread


Similar .NET Framework bytes