Networking problems with LXC


I’m new to LXC and I keep having trouble with lxc-net. When I boot the host machine, somtimes (but not always!) the lxc-net.service fails to start up, it seems. Starting a container then the network connection fails after a few seconds on both, host and container. When I do “sudo systemctl restart lxc-net.service” everythin works fine then.

I set up a bridge device on my host ‘lxcbr0’ with fixed ip host os ist debian stretch.

I found an interesting output of ip r
When start-up fails, the fist line of ip r reads “default dev vethNF59YH scope link” and on succes it’s “default via dev enp0s25”

Any ideas? If you need any config files, just tell me which.

Thanks, and greetings from Essen, Germany

Edit says: LXC version is 2.0.7

Could the issue be that you’re creating a bridge before the lxc-net service does? Afaik it does check for existing bridges, but maybe it’s not quite able to handle your situation correctly. The restart might then explain it, since the shutdown tries to remove the existing lxcbr0 device, which would clean things up for the start that follows.

Hi Adrian,

well, that was my first thought as well, I tried to rule that out by changing /etc/systemd/system/networking.service to
Description=Raise network interfaces
DefaultDependencies=no apparmor.service systemd-sysctl.service systemd-modules-load.service lxc-net.service […]

But that didn’t do the trick…

Solved…what shall I say? Networkd wasn’t enabled, don’t ask me why. systemd enable networkd.service and everything works fine now. Sometimes I can’t see the wood for the trees… :wink: