Hello everyone,
I’ve resumed studying your wonderful book “Smart Home Raspberry Pi”.
I would appreciate your advice on assigning a static IP address to the Raspberry Pi board, which is the heart of the system. My router sometimes changes it, forcing me to reprogram all the ESP312 and ESP8266 devices connected to it.
Thank you in advance.
Hi.
I’m sorry for taking so long to get back to you.
I’m currently on maternity leave and doing the best I can to keep up with work.
Unfortunately, we don’t have any guides about setting a static IP address for the Raspberry Pi. In our case, that was never necessary.
I found this guide that seems complete: maker.pro/raspberry-pi/tutorial/set-a-static-ip-on-raspberry-pi-with-nmcli
Let me know if you succeed.
We’ll try to investigate this subject soon and create our own guide about it.
Regards,
Sara
There’s also this explanation on the official documentation, but it doesn’t seem very clear: https://www.raspberrypi.com/documentation/computers/configuration.html#assign-a-static-ip-address
Regards,
Sara
Could use “router DHCP reservation“; if you are familiar with configuring a router from the router admin page. Will need router user name (“admin” typically –not always and router password).
The better long-term fix is still the router DHCP reservation since it survives reflashing the Pi, OS reinstalls, etc. — nothing to reconfigure on the Pi side. Just needs the Pi’s MAC address:
Find mac address of the pi from a terminal:
ip link show eth0 # or wlan0 if on wifi
William
Thanks to Sara and Guillaume for their replies. I found a solution by configuring my router; it’s by far the simplest.
I’m taking this opportunity to share a little tip. Due to a malfunction, my router had to be replaced. However, it’s not possible to change the login/password on the SD card (at least, I don’t know how…). Simply insert a small file named “wpa_supplicant.conf” into the root directory of the SD card and write the following:
country=yours
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
scan_ssid=1
ssid=”yours”
psk=”yours”
}
There is an amateur radio “pi-star” uitility that can be used to create “wpa_supplicant.conf”; when created –save to computer, copy the the root directory “boot”, just fill in SSID, Password, and Country. Utility does the rest.
Regards,
William
I’m glad the issue is solved.
William, thanks for sharing that tool. I was not aware of it. But, that can also be done manually, as we explain in this tutorial: https://randomnerdtutorials.com/installing-raspbian-lite-enabling-and-connecting-with-ssh/#set-up-wi-fi
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara