Bonjour and DHCP issue for developers

I thought I'd throw this out there for anyone who codes like I do.

  • Multiple Raspberry Pi computers (4B, 3B, 3B+, 3A, etc)
  • Applying the standard OctoPi image to each/any of these and keeping the same hostname
  • Average wifi network router with DHCP

It looks like the avahi-daemon (Bonjour) that's running on the Pi tries to negotiate with the DHCP server. If it looks like there's a different host that's been seen recently on the network with a different MAC address and the same hostname then it will attempt to increment the hostname...

octopi-2.local

To you, this will look like your Pi seems active but you can't otherwise reach it (unless you use the new IP address that was just issued). The problem will magically go away when the DHCP lease expires but this may be frustrating in the meantime.

Which is why on my own test cluster I drop an octopi-hostname.txt on the boot partition alongside the WiFi config (or rather, let it get generated by a fabfile) and thus give the pi a unique name and thus domain.

1 Like