I always have a network bridge(br0
) on my workstation to allow QEMU to access
host network directly. However, it stopped working, and I haven't looked into it
until today.
When I looked into NetworkManager settings, I realized that the kernel somehow changed the interface name. There have been absolutely no hardware changes! This is a problem of upgrading kernel so often.
Anyways, I want to re-setup my bridge.
Ubuntu Manpage: nmcli - command-line tool for controlling NetworkManager: This is actually different than the one in Arch Linux.
GNOME Configuration Settings: NetworkManager Reference Manual
According to the manpage, bridge-slave
is deprecated. So, I was curious,
and looked for everywhere on the internet for how should I do then? However,
every single tutorial and blog post only talks about how to use that deprecated
piece.
Yes, you're right. I was triggered, really hard. Hoho.
I'm not sure about the details, but, AFAICT, KDE connection editor doesn't support bridge properly. I filed a related bug last year, but this hasn't been ironed out.
Another option is GTK3-based nm-applet
, but, no, I don't feel like installing
another GTK app. I'm just a stubborn dork.
The initial config:
$ nmcli
NAME UUID TYPE DEVICE
ethernet f0e43247-b5bc-3a08-90f7-934580f6427a ethernet enp6s0
According to nmcli(1), bridge-slave
is "deprecated for ethernet with
master". That is, it should be possible to turn an ethernet connection into a
slave of a bridge. So, I just opened up the network config with nmcli con edit etherent
:
...
connection.master: --
connection.slave-type: --
...
Bingo!
Before changing settings, I need to create a bridge first:
nmcli con add type bridge ifname br0
EAZY
Back to etherent:
$ nmcli con edit ethernet
nmcli> set connection.master br0
nmcli> set connection.slave-type bridge
nmcli> save
nmcli> quit
The above will automatically remove IPv4 and IPv6 configs, and add bridge-port
section.
I also configured the bridge to my liking:
$ nmcli con edit bridge
nmcli> set connection.autoconnect-slaves yes
nmcli> set bridge.stp no
nmcli> set 802-3-ethernet.cloned-mac-address "aa:bb:cc:dd:ee:ff" # MAC addr
nmcli> save
nmcli> quit
Restaring the connection:
nmcli down etherent
nmcli up bridge
This should also bring up the slave, ethernet
, which can be checked using:
$ nmcli con show --active
NAME UUID TYPE DEVICE
bridge 080da411-a8b7-40d1-affa-c6f9b9ccee29 bridge br0
ethernet f0e43247-b5bc-3a08-90f7-934580f6427a ethernet enp6s0
Note that I didn't explore any other methods for changing configs. Maybe one can
edit the network profiles under /etc/NetworkManger/system-connections
directly. Maybe nmcli
is offering some other interfaces. I don't know. I'm
happy with the current result, and I'm simply recording the procedure.