core: Cannot Change Which Is The Default Network Adapter for Home Assistant

The problem

I have a collapsed core VLAN segmented network with 5 different networks that Home Assistant needs to monitor. This has worked well by just deselecting the auto-configure option in the Network panel in Home Assistant. My problem is that I cannot control which adapter is used as the “Default” adapter. I already have a route set to send all non-local HA traffic to the appropriate interface, but when it needs to get non-local resources I want it to only go out to one specific subnetted VLAN. As you can see in the Screenshot below Home Assistant recognizes all 5 adapters and each has its own subnet. But I cannot change the Starred “Default” to another adapter. And it seems to randomly hop around. I think it just looks at what is the first one that returns a reply but that subnet may be limited in what outside resources it is allowed to serve via my firewall. Is there a way or can one be implemented to be able to indicate which adapter to use for internet-based traffic?

image

Thanks again for such a fine product! Proud Supporter of Nabu Casa and Home Assistant for about 5 years now!

What version of Home Assistant Core has the issue?

core-2022.10.5

What was the last working version of Home Assistant Core?

core-2022.10.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Networking

Link to integration documentation on our website

No response

Diagnostics information

image

Example YAML snippet

No response

Anything in the logs that might be useful for us?

None that I can tell

Additional information

I’m running on a 40 Core Dell PowerEdge R620 with 256GB of RAM and a small SAN. This has VMWare ESXi 7.0.3 U2 installed with the custom Dell Image and Drivers. It has a 4x 1GB Intel NIC card that has been aggregated to the switch with LACP.

Home Assistant has been allocated 8 Cores @ 2 cores per processor, So basically a Quad Socket Dual Core setup with 32 GB of RAM and an install drive of 512GB. It has 5 NICs attached to the internal VSwitch with each on a separate port group per VLAN. This effectively gives Home Assistant an IP Address in each of the subnets it needs to communicate with.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 7
  • Comments: 44

Most upvoted comments

Still an ongoing issue with latest update HA OS 10.5.

nmcli offers a better setting to achieve the desired configuration without removing default gateways: never-default. This setting is available for both IPv4 and IPv6.

I executed the command nmcli con modify 'Supervisor enp0sXX' ipv4.never-default yes for each interface I didn’t want to be the default gateway. After rebooting HAOS multiple times, it appears to work as expected; the desired interface is selected as the default.

I’ve been receding a lot of the same errors everyone else has post 2022.1.1. This exacerbated the issue by blocking host internet access because it would only default to one specific adapter. I need multicast on all VLANs.

Only way I’ve been able to bandaid the situation is to remove all NICs from the VM except the one connected to the subnet I want it to connect on, then once it’s marked as default, slowly readd the NICs one by one hoping that it doesn’t reset.

I’ve done this once before but this is starting to be more and more of an issue as I segment my network more. Please add a way for us to define this setting as I see no other way in the help files.

Nope has not been resolved and is still a very huge problem

Plus unfortunately your method leaves out IPv6.

Shudders

Which is currently the only publicly accessible addressing us Starlink users can utilize to have outside access to our HA interface

I feel for you on that one. I’m lucky that I have 3 static external IPv4 addresses and 1G/1G (meant to be 2.5G/2.5G) fibre. I managed to get IPv6 up and running on my network (since my new ISP gave out a static subnet). But I decided it wasn’t worth the extra work to understand it all, and without fully understanding it and how my firewall dealt with it etc, I was worried I would open up my network to the world. So I turned it off again.

I think the reason that the move to IPv6 isn’t really progressing as quickly as it should is that the IPv4 address shortage isn’t really getting any worse anymore since most ISPs have moved to CG-NAT and that works perfectly fine for 99% of users. And when us nerds/enthusiasts need a static IPv4 address, we can usually pay a little extra for one, or change to an ISP that offers them. Unfortunately if Starlink is your only decent option, then you are in a pretty rough situation. Thanks Elon 😦.

I just spent the last 3 hours trying to work out why Victoria Metrics add on couldn’t hit the prometheus api. Finally worked out this was the cause.

I did this:

nmcli connection edit “<LAN connection name>”

nmcli> set ipv4.route-metric 1

nmcli> save

nmcli> quit

and it’s working after one reboot. Fingers crossed it sticks next time I reboot and after an update.

This needs to be sorted.

There are back ways of reconfiguring the NIC through nmcli but we shouldn’t need to.

Plus unfortunately your method leaves out IPv6. Which is currently the only publicly accessible addressing us Starlink users can utilize to have outside access to our HA interface. This is due to the proprietary way they handle data transfer stuffing you behind a CG-NAT network. Minus the TOR protocol, I can only access my interface fully by utilizing Nabo.Casa and its proxy abilities to utilize IPv6 and translate it to a IPv4 network that is still primarily how most of the world’s internet infrastructure. The more and more people who convert their networks over to utilize IPv6, will then help the rest by providing the new infrastructure that’s available.

I find it funny that something as important as the internet has taken over 20 years to even begin to utilize a standard that has been ratified for several decades. But I digress, hopefully more and more satellites “shells” with laser backbone hubs will help with that and also give us a publicly accessible IPv4 random address that we can sDNS through with something like NGINX.

In either situation it’s still going to need the ability for the administration to mark the “default” route traffic should take for any non-localized traffic. And it shouldn’t be a back door command line fix for something as primary and important of a setting as this. A simple additional checkbox shouldn’t and maybe add VLAN tagging of packets per interface so it takes less stress on your router and layer 3 infrastructure to get the data routed to the right VLAN interface.

I can see where there are problems trying to make this standard seeing as they don’t know the nature of the install. But us who utilize a higher end Firewall/IPS/IDS will be a lot happier. I’m thankful I have a Firewalla Gold decked out with an extra fast RAM upgrade. Can’t recommend them enough. They are on the higher side of most people’s network price point. But it blocks almost 1.2 million false connection attempts a day. Including the multitude of IoT devices that are calling out to CnC servers in foreign countries.

But I hope that works for you until they get a better option. Until then I’m still fighting it as even my DHCP reservation trick hasn’t seemed to work either as of late. And it won’t let me save without a default gateway set if I go manual on each interface.

I just spent the last 3 hours trying to work out why Victoria Metrics add on couldn’t hit the prometheus api. Finally worked out this was the cause. I did this: nmcli connection edit “<LAN connection name>”

nmcli> set ipv4.route-metric 1 nmcli> save nmcli> quit

and it’s working after one reboot. Fingers crossed it sticks next time I reboot and after an update.

This needs to be sorted.

For me the nmcli workaround does the trick.

Still an issue as of 11.3. Any chance we can get a response or a work around? Setting the desired adapter to static didn’t help.

same for me. Looking forward to be able to define the default interface

nmcli offers a better setting to achieve the desired configuration without removing default gateways: never-default. This setting is available for both IPv4 and IPv6.

I executed the command nmcli con modify 'Supervisor enp0sXX' ipv4.never-default yes for each interface I didn’t want to be the default gateway. After rebooting HAOS multiple times, it appears to work as expected; the desired interface is selected as the default.

^ This! ^

Given how common it is in the community to use seperate IOT vlans I sure hope this issue gets some love

As a temporary workaround, I was able to configure the correct default adapter by:

  • Increasing the metric of the interface that I wanted as default (IOT and Guest VLAN’s had metric -1 and my LAN got metric 1 to give it a higher priority for routing
  • Assigning a static IP to my Guest and IOT VLAN interfaces instead of using DHCP. This way I could remove the gateway assignment (which is not strictly needed for the HA instance on these interfaces). Since it not longer has a default gateway on the Guest and IOT interfaces, all outbound (WAN) traffic is always routed via the LAN interface

To modify the route metric and remove the default gw:

$ nmcli connection edit "<LAN connection name>"

nmcli> set ipv4.route-metric 1
nmcli> save
nmcli> quit

$ nmcli connection edit "<IOT/Guest connection name>"

nmcli> remove ipv4.gateway
nmcli> save
nmcli> quit

## Restart / Reboot

image

enp3s0 is my LAN interface, the other two are the Guest and IOT interfaces

I have the same issue.

I have my homeassistant connected to 3 separate networks, via 3 different interfaces. Each interface has a different public IP address.

image

I need to be able to force homeassistant to use a specific interface as the gateway. This is so I can correctly set my dynamic DNS IP address for some webservers I host.

When homeassistant is using the wrong gateway, I am reporting the wrong IP address to my dynamic DNS provider.

The only fix I have found is to disable the other interfaces, which is undesirable.

I realise these selections are only for multicast, however how do I set the gateway interface of choice in homeassistant? This random “Default” is beyond maddening!