[SOLVED] ARP request -- Need MAC address from IP


In a project I am developing, I need to get the MAC address associated to a certain IP, but I cannot see any way go get it. I thought about doing an ARP request, but I see no interface to do it. I also could ping the IP and then check the ARP table, but I also see no way to do this.

EDIT: I am using an Arduino Ethernet.

Any ideas?

Thank you!

You will probably need to connect, then use the low level function in the W5100.h file to get the Mac address.

Any idea how? :blush:

Will this one give me the mac from the IP after connecting? There is no comments in the code and I am kind of lost with it. To me it seems that there are only methods to get the local MAC address...

void W5100Class::getMACAddress(uint8_t *_addr) {

This is a function I use to debug the w5100 sketches I have. It displays the mac address of any connected devices.

#include <utility/w5100.h>

byte socketStat[MAX_SOCK_NUM];
byte destMac[6];

void ShowSockStatus()
  for (int i = 0; i < MAX_SOCK_NUM; i++) {
    uint8_t s = W5100.readSnSR(i);
    socketStat[i] = s;
    Serial.print(F(" "));
    Serial.print(F(" D:"));
    uint8_t dip[4];
    W5100.readSnDIPR(i, dip);
    for (int j=0; j<4; j++) {
      if (j<3) Serial.print(".");
    Serial.print(F(") "));

// this is the remote device mac address
    for (int j=0; j<6; j++) {
      if(destMac[j] < 16) Serial.print(F("0"));
      if (j<5) Serial.print(":");

Connect to the device, then modify the above code to check for a socket that has a status of 0x17. That is the status of a socket that is connected to another device.

Great!! Thank you! It works like a charm :sunglasses:

I already have the socket number, so I just needed to use the call to:

W5100.readSnDHAR(sock_num, destMac);

Thank you, sir!