2

I wanna connect two RPis together with an ethernet cable. I did it and test with ping function and it works, I can communicate.

But for my task I have to be sure that the IP addresses are static on eth0, I don't know if it's the case. Moreover I would like to chose them myself because they don't follow the same pattern (one is 169.254.62.28 and the other 169.254.226.136).

I checked on Google and it seems I have to modify the file /etc/dhcpcp.conf, but all the information I found is when the Pi is connected to a switch/router. So, I don't know what I have to put for this 2 data:

#static routers=?
#static domain_name_servers=?

Can I just modify static ip_address ignoring the previous ones?

Thanks in advance for your help.

  • Use the `*.local` mDNS network names instead of the ip addresses. Most questions on this site are about static ip addresses. No, it does not make things simple. On the contrary, it makes things more complicated if you do not understand detailed networking. Please have a look at all the other answers about [static ip address](https://raspberrypi.stackexchange.com/search?q=static+ip+address). – Ingo Jan 20 '21 at 22:17

1 Answers1

0

169.254. are Link-local addresses and are usable for the purpose you outlined.

They ARE NOT Static IP addresses.

Indeed you don't NEED to know the addresses, hostname.local will work (each Pi should have a unique hostname).

You CAN define Static IP addresses if you want, but you should specify nogateway to prevent these from interfering with routing and there is obviously no need to specify routers or domain_name_servers.
See Advanced dhcpcd Configuration in How to set up networking/WiFi

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • If this link-local addresses are not static, that means they can change? For the moment, they was always same, but I have to be sure. Because In my python script I'll have to write the IP address directly. I'll check that post – Dark Patate Jan 20 '21 at 07:35
  • https://tools.ietf.org/html/rfc3927#page-10 chapter 2.1 « This means that even without using any other persistent storage, a host will usually select the same IPv4 Link-Local address each time it is booted » So yes, the IP should not change often, but it may happens sometimes. (hardware change, OS update, etc.) – Elektordi Jan 20 '21 at 13:08