Ip address changes random

Hi All,
I have a problem that when the device boots it has an dynamic ip from the router.
Now sometimes after a little while it suddelly gets another ip. Normally this is not a problem.
But iam connecting to a mqtt broker and it looks like the connection is still up.
But it cant receive new messages. This because the ip of the device changed and it looks like the container doesn’t know and doesn’t reconnect the broker.

I hope its clear what i mean :).

Do you know about this behavior and or why the device is getting a new ip after the container already run and the device aswell for a couple of minutes.

I just did a reboot. It kept the ip of before the reboot. Then after 2 min the ip changed to a new ip and the device isnt rechable anymore over mqtt. But its also not sending data over mqtt anymore.

I think i have found the solution to the not reconnection mqtt connection. It seems that the keep alive was on 3660 sec insted of 60sec. So i changed that back.

But iam not sure why the device is switching its ip 2 min after the device has rebooted.


It sounds like the device is getting a new IP address from the DHCP server (ie, router) quite frequently. If being able to reach it over the network is important (and it sounds like it is), you could consider giving it a static IP address instead of using a dynamic one.


1 Like

If this device is receiving it’s IP address via DHCP then it is up to the DHCP server as to what IP it has, and how long for. In general the solution to setting up servers (which this, in effect, is) is to give them a static or reserved IP (outside the DHCP address pool). How you achieve this will depend on your DHCP server (in this case, embedded in your router).

1 Like

Yes i gave it a reserved ip and that worked out for now.
The DHCP pool was quite crowded so thats why it was switch more then normally.

thanks for letting us know @RDB !