I’m just going crazy to configure static IP
I used to do that to because I had no better option but you can do better.
However, if you can, you should not use static IPs.
They results in many problems and extra work. That being said, I am NOT saying you should not have a fixed IP for your OpenHAB server, read on…
My recommandation is:
- leave your RPi in DHCP
- tell your router about the Mac Address of your RPi and either let your router’s DHCP provide a random address from its pool, OR setup a static IP in your router so that your RPi always gets the SAME IP, when its DHCP requires a “new” address. This way, you control everything in your router.
- finally, make sure your router does handle the
hostname
of your RPi (it will be openhabian by default but you can rename easily usingopenhabian-config
).
So in the end, you can reach your OH via its hostname, ie openhabian
, or openhabian.yourdomain.com
or whatever hostname you set set and whether the IP of the server changes or now is up to your router/DHCP server.
It is also better this way if you ever decide to setup Firewall rules.
There are many benefits:
- your RPi remains in DHCP, it does not need to know about an address that may also potentially conflicts with otehr devices
- if you need to clone your RPi, your router will provide ANOTHER IP since your Mac Address changed … so you can have both systems running in parallel during the migration
- you can still decide and change your mind, from your router about the fact that your OH has a fixed IP or not (I would recommend a fixed IP…)