Adding a static route to Home Assistant OS

You might find yourself in a situation where your instance of Home Assistant resides within a network of multiple VLANs and your default gateway, typically a locked-down ISP router, isn’t VLAN-aware. Normally, this wouldn’t be a big hurdle, as most appliances provide a method to define static routes. Unfortunately, Home Assistant OS (HAOS) doesn’t provide this capability in an easy-to-manage way.

With access to the CLI, it’s possible to define routes using the nmcli command.

nmcli connection modify "Supervisor enp2s1" +ipv4.routes "10.0.0.0/8 192.168.0.254"
nmcli connection show "Supervisor enp2s1" | grep -i routes

After confirming that the correct routes have been added, restart the appliance for the change to take effect.

ip route
...
ping a.b.c.d
a.b.c.d is alive!

Posted

in

by