Is it possible to find out MAC address of directly wired connected device?

arthur86 picture arthur86 · Jun 14, 2013 · Viewed 22.1k times · Source

I would like to read MAC address of attached device at the other side of the wire. Suppose to have 2 device, that are directly connected by wire. The first one (DeviceX) has Ethernet interface already configured (Static IP ....). The second one (DeviceY) doesn't know anything about DeviceX , but they are physically connected.

There are some way to read DeviceX MAC Address from DecviceY ? It's possible to send some particular packet from DeviceY in such a way the DeviceX reply with some packet ?

I have free access to network API for DeviceY, but about DeviceX i can't do anything.

Thanks in advance.

Answer

hazzelnuttie picture hazzelnuttie · Jun 14, 2013

Computers connected to the same TCP/IP local network can determine each other's MAC addresses. The technology called ARP - Address Resolution Protocol included with TCP/IP makes it possible.

From Windows terminal "arp -a" gives the list of ARP entries

For more on ARP go to this link

____EDIT_____

@arthur86 This can be done by sending "Gratuitious ARP" from Device X (broadcast). A gratuitous ARP request is an AddressResolutionProtocol request packet where the source and destination IP are both set to the IP of the machine issuing the packet and the destination MAC is the broadcast address ff:ff:ff:ff:ff:ff.

Device Y will have its arp cache updated with Device X MAC. Using the arp cache entries, Device Y can get the IP and MAC of Device X.

Check this link for details about Gratuitious ARP