I'm using raspberry pis for an application where I have a number of raspberry pis that need to talk to a central raspberry pi over a local wired network. They are connected using a POE router that assigns each of them a 169.254.x.x IP address.

It's rather inconvenient that the IP address of the central node is unpredictable in advance. This means that my worker nodes each need to be configured with the IP address the central node was assigned so they know which address to ping. Right now this is something I do manually as a configuration step. If I change the central node then all the workers need to be re-configured so they know the new IP address for the central node. I'd like my system to not require this sort of configuration - i.e. the workers need some intrinsic capability to know or find out where the central node is.

I'm open to different solutions to this problem.

1 - The first solution I considered was to set a static IP address for the central node, however, I've found this to be complicated. I tried some of the procedures in this question (How do I set up networking/WiFi/static IP address on Raspbian/Raspberry Pi OS?) however this hasn't worked yet. In particular I edited /etc/dhcpcd.conf by uncommenting the 'static_ip_address' field under 'interface eth0'. Is this a tricky thing to get working in my setup? If you think this is a good idea, any tips?

2 - I've also considered having a procedure where each worker node runs nmap 169.254.*.* to automatically find IP addresses on the network and then ping each to find out which is the central node. However, this seems hacky to me.

I suspect I'm overlooking possible solutions. I'm wondering what you all would do! Thanks!

  • My system is using .local?? for some machines and does not access the DNS on the web. This worked when the internet was disconnected from the router. I do not understand what is happening but others may be able to help. This link explains it much better than I can. web.dev/how-to-use-local-https
    – Gil
    Commented Feb 12, 2022 at 21:45
  • broadcast a message equivalent of "I am the server for blah" periodically to inform workers they can obtain tasks from a server. You can make a setup as customized or modular as you need to if you develop your own protocol
    – Abel
    Commented Feb 13, 2022 at 15:55

2 Answers 2


To answer the question in the title, I think you could use mDNS/DNS-SD to help the worker nodes communicate with the central node. If you know the hostname in advance (e.g. master), mDNS will let the workers contact it using the address master.local without needing to know the IP address. If you don't know the hostname in advance, then the master node can advertise itself using DNS-SD, to tell the workers which IP address to use.

mDNS and DNS-SD are both supported on Linux by Avahi, which IIRC is enabled by default on Raspberry Pi OS. If you don't already have it, you can install with sudo apt-get install avahi-daemon.

You need Avahi on both your worker nodes (so that they know how to make mDNS queries) and your master (to respond), but once it is running, mDNS should work with no further configuration. If you need to go down the route of advertising a service using DNS-SD, you can do this statically by placing an avahi.service configuration file in /etc/avahi/services then restart Avahi with sudo systemctl restart avahi-daemon.service. For example, I use the following mqtt.service file on my RPi4 to advertise an MQTT broker service to other devices around the house:

<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
 <name replace-wildcards="yes">MQTT on %h</name>

Your worker nodes then need to listen for advertisements for your service, to work out which IP address to use. avahi-browse from the avahi-tools package is a command line tool to do this, but there are mDNS/DNS-SD client libraries available for lots of languages that you could use to incorporate the functionality into your own app. Avahi also has a DBUS API you can use to dynamically advertise services.

If you find that your worker nodes can't ping each other using their IP addresses, you probably also need to resolve the problem of link-local addresses pointed out by Milliways. I would try to do this by configuring your router to allocate private IP addresses using DHCP. Normally these are in the ranges 10.x.x.x or 192.168.x.x. If this isn't working for you, you probably need to ask a separate question, maybe in a forum specific to your router brand.

  • Hey, thanks a lot! Avahi seems like exactly what I need. Commented Feb 13, 2022 at 16:52

169.254.x.x is a Link-local address .
Your router DOES NOT assign them.
Some network clients will let you assign addresses in this range but it is futile as Link-local addresses are not routable.

I suggest you allocate addresses from one of the private address ranges.
I use
It is unclear WHY your router does not already do this.

You CAN allocate static IP addresses, but it is far better to get your router do this; I would reserve an address for the central node, although you can get this node to request the router to allocate a predictable IP Address.

This is all explained in How to set up networking/WiFi

In fact, while I would get the router to allocate private addresses I would NOT use these for routing. I use .local for routing between the dozens of machines on my network which works provided each has a unique hostname.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.