Home Assistant Static Network Routes
I run home assistant using the pi docker image. My IOT devices live on different networks to devices in the home and I have a slightly weird network setup at this moment in time that means I can’t create static routes at a router level for a couple of these IOT subnets.
I can easily add the required static routes using ssh into the docker container
/sbin/route add -net 172.16.2.0 netmask 255.255.255.0 gw 172.16.0.153
/sbin/route add -net 172.16.3.0 netmask 255.255.255.0 gw 172.16.0.153
However I’ve struggled to get these saved in the traditional way to survive post boot. This may be a busybox issue, but I can’t crack it in any normal way. As such I’m documenting a quick way of sorting it if you are having the same issue.
This file /run/s6/basedir/scripts/etc.init gets executed at container boot, and you can add routing commands to the bottom of it.