Setting Wifi Fixed IP Address On Fresh Openhabian

I installed openhabian as a good starting point to getting openhab2 up and running on a new Raspi3 to replace a working openhab 1.x installation.

From past experience of using Pis as application servers, I do have my own working method of setting a fixed IP for wlan0 however this is a bit scrappy and so I was keen to do it the “right” way this time around.I’m attempting to keep my openhabian as clean as possible and do things by the book this time.

So the question is, does anyone out there have a method that gets from the openhabian install to a fixed wifi IP, that can happily recover from the wifi dropping? Instructions/relevant files would be appreciated.

Yes, the cleanest solution to accomplish that is to assign a fixed IP for your RPi wifi interface in your DHCP server settings (in your router). Probably every DHCP commonly used has such an option and should be your preferred option. This holds numerous advantages (which you can find on google).

If this functionality is not available,

I hope this was helpful.

Thank you Thom! Yes, as soon as I read your response I realized I’d missed that option in my thoughts.I’d been in the habit of setting a fixed ip in the raspi servers, but using the DHCP config on the router to keep the various HA devices in groups of fixed ips. Doing the same with the server also has the benefit of making it a little easier to swap my openhab2 raspi’s fixed IP with the running openbab1 raspi. I have a number of hardcoded ESP8266 based devices expecting that fixed ip as their MQTT server address.

The method in the link you posted pretty much describes the solution I’ve been using in the past (omitting the untidy commented out lines that i have).

I deliberately I did not post my usual setup so any suggestions anyone had were not based on any flaws in that approach.

Good thought :wink: Well that is the default way, you wouldn’t do anything wrong here. Over time it is just easier to not fix the IP of a device inside the device. Looking at an ethernet-connected device, that would for example create the problem, that the device is not reachable an another/ a new network. Additionally you will have address conflicts or similar ugly problems. Using a DHCP server is easier and gives more flexibility.

All done and working. :smile: …now to get nginx working so have a secure https running for the openhab andriod app from outside. It is a shame there isn’t a little more information/examples in the openhab getting started documentation, although it’s a work in progress I realize.

1 Like

If you are using openHABian, just use the integrated automation for Auth+HTTPS+Let’sEncrypt…