How to configure a network static without a gateway


long time user / reader first time writer :slight_smile:

TL:DR How to configure an network interface with an static IP without an Gateway?

I’m running homeassistant with the HASOS VM image.
The VM has two network interfaces,

  • one connected to the LAN which is used to access the Webfrontend and also for HAS to interact with some devices in the LAN.
  • a second network interface is connected to the IoT network which mostly contains ESP based Tasmota / WLED devices.

edit: Both interfaces are static configured and no DHCP is involved

In both networks a gateway is present so e.g. OTA updates for the ESPs are possible. BUT HAS should not use that gateway as it results in some strange behavior (which might not be HAS related, still trying to understand it completly). Turning of the IoT interface resolves the problems but breaks discovery of devices in the IoT network. If HASOS decides to use the LAN gateway everything is fine. This seems to change from boot to boot. So normally i would configure the IoT Network without an Gateway but i can’t do that with HAS as the CLI simple does not allow it and the UI always puts in a gateway by it self. I guess i just miss something here.

edit: i forgot initial to mention that the network interface is configured static and not using DHCP

It sounds like your HA server is using DHCP.
It is generally not adviced to use DHCP for servers.

DHCP is fine, with reservations for servers (no sysadmin wants to go manually changing IP addresses on a server :wink: )
What is not fine is to have 2 DHCP servers both sending a default gateway, which seems to be the case here.

1 Like

Yeah, sounds like that to me too. This will cause havoc.

BTW (all here), this is a good write-up:

1 Like

To me it just sounds like to land, probably VLANs.
The issue with a DHCP server and dynamically assign IPs is that the DHCP server will provide both the IP and the default gateway for the LAN and you often have no way of refusing the gateway only.

Besides that the correct way would not be to have HA on two LANs, but to let the router do what it is there for, route the traffic.
This is also often way safer, because the router often have a firewall that can limit the traffic.
I would (actually have) place HA on the IoT lan and then open up for the few ports needed on the other lan.

Wow so many responses. No I’m note using DHCP, HAS don’t let you configure a static IP without also configuring an Gateway (or at least i dont mange to).

I’m not sure if thats the correct way. Our router knows all networks and in the initial setup HAS only had one network interface. The LAN network has a gateway to reach all other networks on side. But i don’t want to flood the LAN network with all the multicast traffic needed for autodiscovery, light sync UDP etc etc present in the IoT network.
I’m aware that i could have some kind of multicast to unicast firewall rules on the router but this will still not work with all zeroconf stuff. Having more then one network on a server is a very common thing, i just did not find a way to configure HAS OS the way i would configure a Linux server and only provide the IP address without also configuring a gateway for the network which should not be used as internet access.

You should probably have said that in your OP :wink:
No clue myself, not using HAOS.

Your right, i thought its clear i will try to edit the question

That is why I placed my HA on the IoT network.

1 Like

@derpeter: FYI Home Assistance is shortened with HA most of the time.
Using HAS can be mistaken for a conjugation from to have, being emphasized with capitals for some reason.

1 Like