IP conflcts

When Arduino uses the Enthernet library, it first setup up its own IP, for example.

byte ip[] = { 192, 168, 0, 154 };

I'm trying to implement Bonjour/Zero conf. I'm wondering that if the local IP conflicts with the another IP in the same networs, what happens. Arduino automatically selects it randomly and try it again or does not work? If so, is it efficient that we choose the IP using random function?


If there is an IP address conflict, then one of the IP addressed devices is 'bounced' depending on the internal software of the device and the configuration of the router/switch. The Incorrect IP address can cause multiple devices to try and talk on the network at the same time, causing collisions and the network to significantly slow down.

The 'correct' way to choose an IP address is to allocate '' as the address , then implement a DHCP service on the board. ALSO you need to keep track of the amount of time the address has been allocated to you and ask for a renewal using the same DHCP service. Like this:

  1. allocate ''
  2. Query DHCP service
  3. update ip address to one allocated by DHCP
  4. start countdown on IP validity time (time is notified in the DHCP packet)
  5. at 50% of time ask for renewal goto 2 (switch/router may or may not issue a new IP address, or extend the time of the current one)

Many of the DHCP example scripts fail to perform 4 & 5, which leads to some people complaining that their boards stop after a few hours or days, ultimately it all depends on your switch/router configuration and how it deals with DHCP.

There are plenty of examples out there.


Thanks for your info.

I will look at it : D