IS there a way to send a ARP command from Arduino?

Hi,

This might be a weird question because I am not very familiar with network technology. What I want to ask is actually:

When the arduino broad gets an IP from DCHP server, can I let the board send an ARP command (or something similar) to verify if this IP is used by other device, and then send an DECLINE message back to the DHCP server?

We want to do this to avoid IP confilcts in case some network device didn't renew their IP and occupy an IP that we want to use.

Thank you.

What makes you think a device would not renew the dhcp lease?

If the localnet uses dhcp, and a device wants to use a static IP, the device should use an IP outside the dhcp range.

I use MikroTik routers, and they do that check for me. The dhcp server on the router attempts to ping the IP it is about to issue. If a device responds, the dhcp server marks that IP as "busy" and gets another IP from the pool.

I know it sounds unusual, but we do have this kind of issues (devices not renewing the lease).

We cannot assume all the static IPs are excluded by our customers. We are not sure if our customers use the routers that check for IP confilcts either. So, we have to deal with it.

I would suggest using the same technique, but it wouldn't work until you assign an IP to the Arduino. If the IP you assign is already in use, the ping would fail. I am not aware of how to access the ARP request functions in the w5100.

You would have to use MAC RAW mode, but yes it's possible. Maybe the ARP module from this small TCP stack would get you headed in the right direction:

http://sourceforge.net/p/minitcpstack/code/ci/master/tree/SRC/ARP.C

And of course, Wikipedia contains details on the protocol:

Sounds like I have to implement ARP by myself.

Thank you guys! :slight_smile:

laishiekai:
I know it sounds unusual, but we do have this kind of issues (devices not renewing the lease).

We cannot assume all the static IPs are excluded by our customers. We are not sure if our customers use the routers that check for IP confilcts either. So, we have to deal with it.

For example, some example codes in "Ethernet" library section do not call maintain() in the loop(). The DHCP lease will expire and the Arduino program will not renew anything if someone just copy & paste the codes. That's actually how we get devices not renewing the lease :slight_smile:

Here is a helpful thread:
http://forum.arduino.cc/index.php?topic=74547.0

I will post my arp codes after I finish testing it.

1 Like