HA OS loses statically set IP address

I have set HA (x86-64) to use IP 192.168.1.139 in web interface. It’s fine if network is present and Internet router is running. However, if the HA machine has to boot while network is not connected or router is down (we have power outages sometimes and all machines have to be restarted), it boots with IP of 172.31.xx.xx something and on network re-connection keeps this wrong IP. Only full HA machine reboot fixes it.

Why does this happen and how to fix it?

Best bet is to set the static IP on your DHCP server (router) than in HA. This will stop the router from assigning that IP address to something else. You obviously can set the IP on HA if its outside the range the DHCP assigning but in my experience it causes more issues than it should.

Funny thing, actually. If I do tie a certain IP to the HA server by mac address in my router, HA starts seting its IP to 172.31.xx.xx no matter whether it’s connected to network or not. I.e., it doesn’t work at all then.

What is your HAA installation method? Running bare metal, container, VM? Different networking issues might arise with any of these methods…

It’s HA OS, as stated in the subject.

I assume it is bare metal not VM.
If you set up HA to use Automatic settings (e.g. to use DHCP on your router) and you are not receiving proper IP in HA, it might look like strange miscommunication with router. Do you run any other device in your network that might act as DHCP? Some switch, PiHole, AdGuard Home etc?
IP address your HA gets configured seems a bit strange. Normally, in case of some misconfiguration auto assigned IP should be 169.254.xx.xx, not 172.31.xx.xx, so it looks like it is receiving this IP from somewhere. It is strangely similar to docker subnet…
Can you make screenshot of your HA network settings? Seems like mismatch between router and HA network settings. Nine looks following:

and I’ve never had issues with HA loosing IP, regardless of router or internet connection status.

Hi,

Try to set HA with a static IP-adress outside the DHCP scope.