Using NetworkManager to manage a lxdbr0 bridge

Mark Constable

Mark Constable

I like to create a lxdbr0 bridge on my laptop so I can easily deploy LXD containers and, as I treat my laptop like a workstation, I hardly ever move it so I can use an ethernet connection instead of wifi for full gigabit local area network speeds. Setting up a bridge to a wifi device is somewhere between difficult to impossible and not worth the time spent Googling it (as convenient as it might be.) In the past I used the networking systemd service and more recently I tried systemd-networkd and both of those methods work fine but require manual editing of files and switching to mobile via NetworkManager (being disabled) is awkward. A couple of times over the last few years I’ve tried using the bridging facility within the network manager gui (plasma-nm in my case) and it mostly creates the bridge config files but never seems to connect to the slaved ethernet interface.

So this is mostly a note for myself in the future when I do a reinstall and need to repeat this trick to get NetworkManager to finally create a full working bridge when activated. I call the bridge lxdbr0 because that is what LXD expects to use when and if I want to set up some containers. The trick is to manually add just two extra lines to the NetworkManager ethernet system config file such as (example only)…

master=lxdbr0
slave-type=bridge

Why on earth the NetworkManager gui won’t do this automatically is beyond me! So for reference here are my two NM bridge config files where my ethernet interface is called enp4s0f1

cat /etc/NetworkManager/system-connections/enp4s0f1
[connection]
id=bridge-slave-enp4s0f1
uuid=f9691217-52c2-499e-b310-d5ccd7e1373f
type=ethernet
permissions=
interface-name=enp4s0f1
# manually add these two lines below
master=lxdbr0
slave-type=bridge

[ethernet]
auto-negotiate=true
mac-address=80:FA:5B:00:2C:48
mac-address-blacklist=

[ipv4]
dns-search=
method=link-local

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

And the default bridge file as created by the NetworkManager gui…

cat /etc/NetworkManager/system-connections/lxdbr0
[connection]
id=lxdbr0
uuid=2140d6a8-fb95-4d93-9488-58b64e216b81
type=bridge
interface-name=lxdbr0
permissions=

[bridge]
stp=false

[ipv4]
address1=192.168.0.2/24,192.168.0.1
dns=192.168.0.213;
dns-search=goldcoast.org;
method=manual

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=ignore

Share this post