Unable to set a static IP - Incorrect warning about subnets

Hubitat C8 (2.3.7.145)

When I try to set a static IP, it is failing to do so. It's returning an incorrect error of "IP address must belong to subnet 192.168.0.xxx or you will not be able to communicate with the hub"

I want to set the IP address 192.168.2.110, default gateway of 192.168.0.1, and use a subnet mask of 255.255.252.0 (/22). The form appears to incorrectly determine that 192.168.2.110 is not in the subnet as the subnet is 192.168.0.1 - 192.168.3.254, unless I am misunderstanding what the error is complaining about. I am able to set this IP just fine when using a DHCP reservation from my router but I would rather just have a static IP for my device.

1 Like

The recommendation for Hubitat hub, is to actually set a reservation on your router. If that works for you, stick with it.

It looks like the hub cannot tell that 192.168.2.110 can use 192.168.0.1 as the gateway when setup as a /22 network. It seems to expect a 192.168.0.xxx address even though the subnet mask is set for /22.

1 Like

Here's the endpoint to set up a static address in a non /24 subnet:

5 Likes

I guess my first question would be why are you trying to set a static IP on the hub Rather than a DHCP reservation on your router? The best approach, and this applies to pretty much any network device, is to set a DHCP reservation on your router.

If you're not sure how to do this there are tons of videos and other helpful posts on the internet for almost any router imaginable. I suggest you drop trying to set the fixed IP on the hub and set the DHCP reservation.

4 Likes

I believe it’s a consequence of DHCP being the norm for the overwhelming majority of routers and other networking equipment used by consumers in their homes.

2 Likes

It is

Are you inputting the full ip, subnet, and gateway?

It's not

No one else has issues. Now if you're trying to use it on an expanded subnet you need to enable the endpoints. The reason this is done is for simplicity.

A lot of things you cannot set a static ip on. Any of these devices that interact with Hubitat should have a DHCP reservation so things are not lost track of which can happen due to cacheing.

3 Likes


I want to chime in that this is still a problem.

1 Like

I am not a networking expert, but is "or" a valid option for the subnet mask? I see no evidence in any of the documentation or the community post that says this is a valid format.

It's a drop down value so probably using /22 behind the scenes

2 Likes

Yeah thats for a sure a bug, with that gateway and netmask you have an IP range of 10.0.0.1 - 10.0.3.254

Apparently it is just going to the highest /24 range and thinking you need to be in there.

You would have to use the endpoint listed above to force it in there. Somewhere in another thread I posted an example of how to build the query string for that endpoint...

Static IP Address and DHCP Support for non /24 Subnets - #13 by gopher.ny
/hub/advanced/switchToStaticIp - accepts the following query string parameters
address
netmask <- use 255.255.254.0 for /23 subnet.
gateway
nameserver

1 Like