Solved

Remote MAC Address Using IP Address

Posted on 2013-11-28
6
463 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 46

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

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 46

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

734 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