MIgration with LXD/StaticIP/Bridge

I’m setting up containers with a static IP address. When complete, I have to create a route on the host like this:
/sbin/route add -host CONTAINER-IP dev lxdbr0
This works great, except when I reboot and I suspect, if I live migrate the container to another host.
Is there a way to add this HOST NODE route to the container config so that each time that container comes up, the host node will add this route as a static route?

Not to the container’s config, but you can set ipv4.routes on the lxdbr0 bridge which would do the same.

I saw that function. So if I set that, the route will come up when the container comes up? And if I live migrate, will the route follow the container or do I need to set that up on the remote side?


Stephane, the new setting works great! But now a different problem: Say I am using Keepalived inside the container and want to add an IP to the container that will not survive a container reboot. The tools above work perfectly, from inside the container I can tell the HostNode to add a route to the new, floating IP. However, once that route is added, either to the container config or static, it stays even if the container is rebooted. Ideally, I would like a way for the route to go away if the IP is no longer in the container. Also hoping to avoid running a routing daemon inside the container.