Solved

Remote MAC Address Using IP Address

Posted on 2013-11-28
6
445 Views
Last Modified: 2013-12-06
Hi
I am developing a console app that will run from the command line on a Windows 2008 R2 64 bit server.  Using C++, what is the most reliable method of acquiring the MAC address of a remote Microsoft Windows machine using its IP address?
Thanks
0
Comment
Question by:antonms
  • 3
  • 2
6 Comments
 
LVL 2

Assisted Solution

by:weifai
weifai earned 167 total points
ID: 39684014
Have a look at the SendARP function: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366358%28v=vs.85%29.aspx

It makes an ARP request and returns a MAC address in its OUT parmeters.
0
 
LVL 45

Assisted Solution

by:Craig Beck
Craig Beck earned 333 total points
ID: 39686780
ARP is a good idea, but won't help if the remote PC is on a different VLAN or on a distant network across the internet for example.

ARP uses a broadcast on the same network segment.  If the IP address is on a different subnet the client wouldn't initiate an ARP request for that device's MAC address - instead it would send the request to the default gateway.
0
 

Author Comment

by:antonms
ID: 39688523
Hi - thank you both for your replies - SendARP looks to be the solution. However I was wondering how well SendARP would work if the PC was a virtual PC and/or if there was more than one MAC address at the IP address?
Thanks
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 45

Accepted Solution

by:
Craig Beck earned 333 total points
ID: 39689569
A virtual PC will be assigned a virtual MAC address, which will respond to the ARP request.

An IP address can't be used by more than one MAC address at a time, so you'll only ever see the MAC of the device that's actually using the IP at the time.
0
 

Author Closing Comment

by:antonms
ID: 39701853
Thanks. After much testing SendARP() proved to be a reliable solution across all MS Windows platforms.
0
 
LVL 45

Expert Comment

by:Craig Beck
ID: 39701987
Cheers, but you should mark the answer by: weifaiPosted on 2013-11-28 at 18:25:15ID: 39684014 as the answer.

:-)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is the first one of a series of articles I’ll be writing to address technical issues that are always referred to as network problems. The network boundaries have changed, therefore having an understanding of how each piece in the network  puzzl…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question