
But I could not find a way to get an IP address from a MAC address. It will be very nice if I can use the same method on Mac, Linux and Windows machines.Īs far as I know, I have to broadcast a ARP packet to the network in order to retrieve a MAC address from a known IP address. I would like to know how to retrieve the IP address in a more sophisticated way. Find the known MAC address and the corresponding IP address from the list.Execute arp -a to print a list of IP and MAC addresses.Execute ping command ping 192.168.0.2 (NOTE: the instrument does not respond to ping).For example Colon-Hexadecimal notation is used by Linux OS and. By convention, these addresses are usually written in one of the following three formats, though there are variations. But I need to know the IP address before opening a socket (WinSock on Windows, sys/socket on OS X and Linux).Ĭurrently I use a very dirty way as shown below. Traditional MAC addresses are 12-digit (6 bytes or 48 bits) hexadecimal numbers. I would like to write a C/C++ application which talks with the instrument using a socket connection. I know the MAC address of the instrument, but please assume that its IP address is unknown.

The PC and the instrument are directly connected over a UDP socket with a CAT5 cable. In my case, there are only two devices: a very normal PC (192.168.0.1) and a scientific instrument which has an arbitrary IP address (192.168.0.xxx) hard coded in its ROM. I am looking for an easy way to convert a MAC address to the corresponding IP address in a local network.
