Link to home
Start Free TrialLog in
Avatar of aquila98
aquila98

asked on

How to convert MAC address to IP address on a WinNT network???

Hi,


I have a library that can display computers which accept a certain type of RPC call
(they have a listenner running)... Only this give me a list of MAC addresses!!!

How can I convert those MAC addresses to their IP address (and eventualy to
host name) ??? I need to be able to do something like arp -a does, which is
to list computers by ip address or hortname and present this to the user,
NOT mac address which nobody knows about here ;-)

I am running Windows NT 4 sp6a.

Thanks for any info...
Avatar of BlackDiamond
BlackDiamond

You have to use arp.  Remember that MAC addresses are used at layer 2 and IP is layer 3.  You will only be able to see MAC addresses that are in the same broadcast domain (on your subnet).  The easiest way is if you have a list of MAC addresses, then ping the broadcast address(x.x.x.255 for a class c) of your subnet.  Then if you do an arp -a, you will get a list of all the ip's along with the MAC address for you subnet.  Then you can do a 1 to 1 match with your 2 lists.
Avatar of aquila98

ASKER

???

And how can i do an arp -a by programmation???
Remember this will be used in a VB application, so I have to present to my users a
list of IP address-> machine name -> services availables, all I have is:
MAC address...

Ideally I want a function like string _GetIpAddressFromMac(const string& MACAddress);
I do have SocketTool which does have a ICMP com object (ping)...

Is there a class that implements ARP??? Or a COM somewhere (free???)

thanks
ASKER CERTIFIED SOLUTION
Avatar of BlackDiamond
BlackDiamond

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks...

I'll look it up also... Anyway I could always do it "manually" and insert the table MAC->IP into
a map and build a ini file around that so my VB app would "know" which IP address
corresponds to which MAC address... For a while at least.


Yeah, that's a decent work around.  Do you have the source for the RPC library that you are using?  It just occurred that it probably has the IP address and the MAC already, but is just not returning the IP to you.  The other thing you could do is bug whoever made the library.  It would probably be a very small change to make that info available to the user (or maybe it is, and is just not documented).  It seems that the library would be much more useful with that feature. hmmm.
Cheers,
BD