I have dozens of smart homecdevices that I access and control in a home management system called Home Assistant. For many of these to integrate continuously, I need the ips to be static.
Such devices include Tapo smart plugs and meross Smart power surge sockets.
I have noticed that with many of these, they are defined as static but not all. Some are DHCP assigned and cannot be changed. I am struggling to understand why there are such variations. The plugs are identical and are paired via the relevant apps using identical settings. Clearly, I do not understand DHCP and ip addresses. Dhcp is enabled and authoritative dhcp disabled. I regularly see ip addresses changing for those devices that are not static and this breaks parts of my Home Assistant device controls.
The dhcp server address range is currently the default ....64 to 253.
I may need help in understanding how assigning static ip addresses works including limits on the number of attached devices that can be static.
Right, let's get the terminology sorted out for a start. By definition a 'static' IP address can only be set on a device itself, a router cannot assign a 'static' address. All addresses allocated by a router are allocated via DHCP. There is, however, a function called address reservation which folks misname as static addressing. Address reservation ensures that DHCP allocates the same IP address to the same MAC address each time.
In the hub manager this is selected by the 'always use this address' toggle.
OK thanks.
For some, I have set the "always use.." toggle successfully. However, others either do not let me toggle this or, when saved, the toggle is still set as "no".
I realise that this is not random and will be totally logical but it escapes me as to why.
Images of one that I could set and another that I cannot toggle in Change Settings mode:
I did mess around on the router with enabling and disabling dhcp. Not a good idea when you don't know how it all works. As a result of disabling dhcp and restarting the hub, I lost access to 192.168.1.254.
Had to factory reset so now back to the initial situation. I realise that dhcp uses leasing and after the set period of time, devices may drop the current ip and be assigned a new one. Anything that is in current leasetime, it appears, cannot have the "Always use...." set and saved.?????
I could up the lease time from 1 to 21 days which will mean my issues only occur after 21 days but I don't know what downsides this may cause. I thought that reserving ips would be easier than this.
As already stated, address reservation relies on DHCP so must be enabled. Changing lease time will have no detrimental effect.
Do any of the devices that are not maintaining their address have MAC address randomisation enabled? If so, disable it.
sorry for the delay. As far as I am aware, MAC address randomisation does not occur. However, this is controlled by the Tapo app and as here is no option available, I can only assume it is always fixed. I do have some old screenshots of router devices that have suffered this issue and the mac addresses appear to be consistent
Another Home Assistant user - good for you!
I see you currently have the IP address range set to 64-253 so I suggest you manually change all you HA device IP addresses to within the reserved range e.g. 1-63 and then enable 'Always use this IP address'. You'll probably have to reboot each of the HA devices to force them to use the new IP addresses. I keep a list of all mine (along with associated MAC address and description of the device) and suggest you do the same to ensure you don't accidentally use the same IP address more than once. And if you have loads of devices you can always reserve more - I think my range for dynamically assigned IP addresses now starts at 160!
I don't use a BT Smart Hub but know there were issues before with setting/saving the 'always use this IP address on BT Smart Hubs. Another way of achieving what you want is to set a static address on each of the devices e.g. set the IP addresses on your Powerline adaptors to within the reserved range e.g. between 1-63.
@Pedro1959 The address range 1-63 is outside of the default DHCP range of the hub and is available for giving devices STATIC addresses on the devices themselves without fear of clashing with DHCP allocated addresses.
For ADDRESS RESERVATION, it is not possible to allocate an address manually, it must first be allocated by the hub's DHCP server and then reserved consistently for the device.
Aaah, the foibles of BT routers! You can do it with both Draytek and Ubiquiti routers…I knew there was a reason I changed!
So I guess you can either set the dynamic range lower to get the Smart Hub to allocate low IP addresses, set ‘always use same address’ and then change the dynamic range back to high, or set fixed IP addresses below the dynamic range on the devices instead?
Thanks for the informed response as I am going to have to go through this tomorrow for my brother on his Smart Hub 2…