Containers network stop when restarting network in host

I am using bionic

lxc --version
3.0.3

I have 2 network cards. eth0 for the host and I have a br2 for all lxd. Note that br2 is assigned to lxd and eth0 is NOT used by lxd.

auto eth0
iface eth0 inet static
    address 10.147.17.50
    netmask 255.255.255.0
    broadcast 10.147.17.255
    gateway 10.147.17.254
    dns-nameservers ***********************


auto br2
iface br2 inet manual
    bridge_ports enxa0cec81f12bc

Now I make changes to eth0 (change ip) and restart networking.
systemctl restart networking.service

All of my lxd instances are out of network. I need to do this to bring lxd-containers to normal.

lxc exec container-name bash
reboot

Why does this happen? Note that systemctl restart networking.service
does not hang or delay or complain. Everything is clean in dmesg.

Any ideas

systemctl restart networking will destroy your br2 device and created it back up.
When it does that, it has no idea that you have things other than what’s listed in bridge_ports in there and so all containers are left unbridged.

The solution is to not run systemctl restart networking but instead run a much more targeted ifdown eth0 && ifup eth0 in a screen/tmux session so only eth0 is modified and br2 is left alone.

1 Like