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

25,732

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

Share:
25,732
arthur86
Author by

arthur86

An Enthusiastic software engineer working with several programming languages: C, C++, C#, Java, Python, Javascript and so on ...

Updated on July 09, 2022

Comments

  • arthur86
    arthur86 almost 2 years

    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.

    • unwind
      unwind about 11 years
      Is DeviceX running an operating system? Which one?
    • eyalm
      eyalm about 11 years
      what do you mean by directly connected? Is it a crossed Ethernet cable between the 2 devices? Or is the connection through a hub/switch/router?
    • arthur86
      arthur86 about 11 years
      unwind: DeviceX is a embedded system, with microcontroller using LwIP stack.
    • arthur86
      arthur86 about 11 years
      eyalm: I'm evaluating two possibilities. First one using crossed Ethernet cable. Second one through Ethernet hub. Do you think is better first or second one ?
  • arthur86
    arthur86 about 11 years
    Thank @Manimehalai I'm evaluating this option. Does the ARP protocol work if DeviceY doesn't know anything (No IP address, No Network configuration, No MAc address) about DeviceX ? The ARP protocol shuold be know the target IP Address to request or not necessary?
  • Wes Miller
    Wes Miller over 10 years
    @hhazzelnuttie But the OP says he has no control over device X. He can't have it gratuitous ARP. Or did you mean device Y to issue the g-ARP?