Solved

Remote MAC Address Using IP Address

Posted on 2013-11-28
6
459 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
L2 to EIGRP slow migration? 27 122
FILEZILLA Client "default"? 2 55
C# LINQ ForEach() question 6 110
Where does legacy ASP.NET initialize language? 2 96
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…
We recently endured a series of broadcast storms that caused our ISP to shut us down for brief periods of time. After going through a multitude of tests, we determined that the issue was related to Intel NIC drivers on some new HP desktop computers …
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…

740 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