[Archlinux] Container veth interfaces being assigned to wrong bridge

I have a qemu VM setup on my workstation, configured to get its own IP on the VLAN using a bridge interface. The bridge is created/configured using systemd-networkd. Ever since setting up that VM, containers without --net=host are unable to reach the Internet (or anything else for that matter, including the host IP).

The only thing I can find that seems at least on the surface to be wrong is that the containers’ veth interfaces are being assigned to br0 instead of docker0. I’ve tried explicitly setting "bridge": "docker0" in /etc/docker/daemon.json to no avail. With debug logging enabled, dockerd (and containerd) don’t mention anything about which bridge they’re using:

Apr 10 15:49:21 mc-desktop dockerd[115739]: time="2021-04-10T15:49:21.175291373-04:00" level=debug msg="Releasing addresses for endpoint gallant_wright's interface on network bridge"
Apr 10 15:49:24 mc-desktop dockerd[115739]: time="2021-04-10T15:49:24.148188013-04:00" level=debug msg="Assigning addresses for endpoint loving_carson's interface on network bridge"

And, amusingly enough, if I try to reassign the veth interface manually, it gets reassigned immediately:

[mc@mc-desktop ~]$ brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.18c04d85a0da	no		enp6s0
							veth4a970f5
docker0		8000.024208f354b5	no		

[mc@mc-desktop ~]$ sudo brctl delif br0 veth4a970f5; sudo brctl addif docker0 veth4a970f5; brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.18c04d85a0da	no		enp6s0
docker0		8000.024208f354b5	no		veth4a970f5

[mc@mc-desktop ~]$ brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.18c04d85a0da	no		enp6s0
							veth4a970f5
docker0		8000.024208f354b5	no		

Any tips for troubleshooting would be super appreciated!

1 Like

Hi, I got the same problem…

And your tip about add the veth interface to docker0 helped me a lot…
that’s happens because the systemd-networkd tries to manage the link…

To fix:

I added a new file: /etc/systemd/network/20-docker-veth.network
with content:

[Match]
Name=veth*
Driver=veth

[Link]
Unmanaged=true

and restarted the systemd-networkd service

sudo systemctl restart systemd-networkd.service

after that a new container with bridge network worked for me!

Man, thanks for your post. Almost a year later I still didn’t have a solution…I was just running with --network=host all the time haha

That alone didn’t solve it, but it was a huge step in the right direction. Adding Name=!veth* to the [Match] section of my br0 binding unitfile did the trick.

maybe you need to check and change the priority files…
instead starts with 20- do with 00- to be the first match.
you can check both directories:

  • /usr/lib/systemd/network/
  • /etc/systemd/network/