Solved

Remote MAC Address Using IP Address

Posted on 2013-11-28
6
434 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A few months ago I attended the Rocky Mountain IPv6 Summit which was a two-day educational event; it was the 3rd annual conference held here in Denver, Colorado that was held at the Hyatt Regency Denver at the Colorado Convention Center. It was an e…
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 …
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now