Adding a bridge to my host killed LXC containers' networking

There’s a mostly happy ending here, but I did manage to knock out networking on my containers and would like to warn others, but I’m not really sure what I did wrong.

Running on an Ubuntu 16.04 host here. I have ten containers running on a couple of bridges (br1 on eth0 and br2 on eth0.2). Everything has been working great for over a year. Super happy.

Tonight I decided I need to run containers on another VLAN, so I set up another bridge, br20 on eth0.20. Restarted networking, noticed an issue in my configuration on the new bridge (had the interface as static when it should have been manual), fixed that, and started it up. Then I set up a new LXC networking profile, launched a new container on the new profile, got it talking to some other hosts on that that VLAN, and patted myself on the back.

Just before packing up, I noticed that the container that runs my note-taking service (Meemo) wasn’t accessible. Uh-oh. Did a lxc exec meemo /bin/bash and poked around. Everything looks fine, except networking. Did the same on another couple of containers. No networking. The only exception is the new container which is on the new bridge. Networking on the container host works just fine, but nothing gets to, from, or between the old containers. The new container works fine, but I think that’s because it was set up after I messed with the hosts’ networking.

Anyways, restarting the containers fixes the problem. So no huge deal, but I’m confused as to what went wrong. Probably starting and stopping networking on the host, which would have brought the bridges down, fouled up the containers, but my expectation would be that they start back up when the bridge they were on came back. No?

I should add that this problem wasn’t relegated to LXC. I have about eight VMs on this system as well running under Libvirt/QEMU-KVM. It wasn’t enough to restart the VMs, Libvirt and QEMU-KVM had to be restarted as well.

First of all I want to recommend to add a new line into /etc/crontab before working on networking issues like

*/5 * * * * root /sbin/reboot

Additionally its a good thing to comment the line which starts with “auto br0” in /etc/network/interfaces especially when using Ubuntu 16.04.
Because if anything goes wrong you can access your box after five minutes again.

After that done you can poking around with brctrl or other networking-tools.