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!