Setting Static IP Address

I’m not sure what I’m doing wrong when trying to set up a static IP address onto my Pi. I’m using ScreenlyOSE on the latest version of BalenaOS and I’m going through the Network guide of how to do it. I have Screenly working fine with my WiFi and then when I go and copy/paste what the Network guide suggests to put in for a static IP, I just get the 4 blinking lights showing that it’s not connecting to the server. Any suggestions? :frowning:

then when I go and copy/paste what the Network guide suggests to put in for a static IP

Note that the values in the guide need to be modified to match your local network (sorry if you already knew that!). For example, your local network may be using a different gateway or subnet. Very common values for local networks at home are:

Subnet 192.168.1.0/24, Gateway 192.168.1.1 or 192.168.1.254
Subnet 192.168.0.0/24, Gateway 192.168.0.1 or 192.168.0.254

Or your subnet could be very different, like 172.17.x.x instead of 192.168.x.x. It can be a complex topic, but to find out your local subnet values, on Windows or macOS, I’ve found this simple guide.

Let us know if this explanation went in the right direction, and we’ll go from there.

I actually knew next to nothing about networking before this, so your information helped me out a lot.
I did have a small revelation though. I was having trouble getting a Subnet IP to work correctly. After a few days of messing around, I noticed the fact that the balena dashboard actually gives an IP Address to the device and I just didn’t connect the two. I was able to put that IP in and set it as the static and I now have access to what I need. Thank you so much for helping me out.

Our business has a couple hundred devices connected and the IPv4 addresses are typically 172.16.4.xxx. So when I am trying to set a static to this one, do I just pick a random number for the x values? […]
I was able to put that IP in and set it as the static and I now have access to what I need.

Good to hear that it is now working and I don’t mean to jinx it, :slight_smile: but if I understood your setup, it may stop working at any time… I assume that the address 172.16.4.133 that you saw in the device’s web dashboard was originally leased (allocated) to the device by a DHCP server (WiFi router/gateway) in your local network. You had previously shared a screenshot of the network settings of your laptop, and there I saw that your local network’s DHCP server (at 172.16.4.1) grants leases of only 30 minutes. It means that, after 30 minutes, the DHCP server (common implementations, anyway) will consider address 172.16.4.133 as free to lease to another device / laptop / phone on the local network. If the same address is allocated or used by your “static” device and by another device / laptop / printer / phone on the local network, then both will have network connectivity problems, such as unstable / dropping connections or going offline.

In other words, setting 172.16.4.133 as a static IP in the NetworkManager configuration for the Raspberry Pi may eventually cause problems to another device (laptop, printer, phone…) on the local network.

To avoid problems, you’d have to configure the local DHCP server / router (172.16.4.1) appropriately. For example, at home we often have WiFi routers that have an admin password that gives access to “advanced settings”. The router’s IP address and admin password are often printed on a label at the bottom of the router. You can open the router’s IP address on a web browser, enter the admin password then look for the DHCP settings page. In an office network, you may need to ask the network administrator.

Then there are two main alternative configurations of the DHCP server:

  • “Classic static IP”: this is the approach you were asking about, where you manually configure the static IP on the device (Raspberry Pi). DHCP servers have IP address “pools” (ranges) that they the lease from, and usually there is a smaller range reserved for static IP addresses. You’d have to find out the range reserved for static IP addresses in your subnet, how they are currently allocated (sometimes there are spreadsheets manually keeping track of this, sometimes even printed on paper and stored in a folder in the same cabinet as the router…), choose an unallocated IP address from that range and document it.

  • “Persistent dynamic IP”: some DHCP servers allow IP addresses (sometimes even addresses from the dynamic pool, e.g. 172.16.4.133) to be reserved to your device, so the DHCP server always leases the same IP address to that device, and never leases that address to any other device. This way, you could revert your device (Raspberry Pi) to the original configuration of obtaining a dynamic IP address, and yet be assured that, on that local network, it will always be allocated the same IP address, which will thus be “effectively static”.

The “persistent dynamic IP” configuration is more flexible and less error prone: it means fewer manually configured settings that can go wrong when moving to a different subnet. Note that with a “classic static IP” configuration, the device will only be reachable or online on a “compatible” subnet (172.16.4.x subnet with a gateway at 172.16.4.1).

Oh, wow. Ok. I’m glad you’re smart enough to catch that before it caused a headache later for me. haha
You are totally correct. I wish I could follow you along perfectly, but I understand the gist of it. I will inform our network administrator and see what we can do about the allocations of the product. I know if this one works out well, we are wanting to put up a few dozen more around the business. Thank you so much for your help and I will update soon about what we decided on and if it worked for us.

Do let us know how it goes, and if there is anything else we can help with. Have a nice day!

Hello

can you tell me how to force a static ip address?