Switch from systemd-networkd to NetworkManager

I have a working Network setup, based on systemd-networkd, which allow me to bridge to KVM guests to the “vlan trunk” or individual “vlan”, per virtual NIC.

enp1s0.network

[Match]
Name=enp1s0

[Network]
VLAN=vl1
VLAN=vl6
VLAN=vl100
Bridge=br0

br0.netdev

[NetDev]
Name=br0
Kind=bridge

br0.network

[Match]
Name=br0

[Network]
DHCP=no

For each vlan (vl1, vl6 and vl100), I have 4 similar files for each of them:

vl1.netdev

[NetDev]
Name=vl1
Kind=vlan

[VLAN]
Id=1

vl1.network

[Match]
Name=vl1

[Network]
Bridge=br1

br1.netdev

[Match]
Name=vl1

[Network]
Bridge=br1

br1.network

[Match]
Name=br1

[Network]
DHCP=ipv4

For each bridge, br0, br1, br6, br100, I have a xml file for them:

br0.xml
<network>
   <name>br0</name>
   <forward mode='bridge'/>
   <bridge name='br0' />
</network>

Then for each, I run
$sudo virsh net-define br0.xml

In the Guest, via virt-manager, if I want to bridge to vl100 (for PXE boot testing), I will add a NIC with Network source of Bridge device…, then enter br100 in Device Name.

It works:

  • vm0 bridge to br0, then create vlan interface in NetworkManger inside the guest to any vlan even those undefined in the host
  • vm1 bridge to vl1
  • vmA brdige to both vl100 and vl6
  • etc

All the guests seems working concurrently well enough for me.

But I know NetworkManager is the default for Fedora. So I would like to recreate my setup using nmcli.

I tried with nm-connection-editor, but only able to create br0. Then have no ideas on how to create br1, etc.

2 Likes

NetworkManager is really serving desktop environments (GNOME, KDE, etc.) to write higher level, easy-to-use GUI programs (It also provides CLI: nmtui, but is still aimed at easy to use by users). It is not for every advanced usage. And it’s not just “default” nor specific to fedora, it’s the only API to use by GNOME and KDE (well, networkmanager-qt wrapping for KDE).
I am not an expert on KVM network passthrough but I think you should stick to systemd-networkd. NetworkManager is really not the right tool, or maybe much harder to configure.
I am not sure about your use case: are you running a server or desktop? If you run a server, you can completely ignore NetworkManager (doesn’t need it to be installed). If you run a desktop, you have to be reminded that NetworkManger conflicts with many daemons like dhcpcd. But for your case where systemd-networkd only adds virtual networks, it shouldn’t conflict so you should leave NetworkManager behind either.

2 Likes

NetworkManager is more suited for dynamic desktop, laptop and mobile environments where you need to connect different WLANs and VPNs, use metered connections, track connectivity, and interact with desktop applications.

Meanwhile, your use case seems to be closer to server-specific with typical server roles such as virtualization, VLAN routing, PXE boot, etc. which are well suited for systemd-networkd, and in that case NetworkManager only adds unnecessary complexity resulting in possible errors.

I have experience with both NetworkManager and systemd-networkd for server-like use cases for several years, and NetworkManager failed me more than once, sometimes even due to serious bugs which were open for months.

2 Likes

Thanks for the inputs!

I want to know how to recreate the setup in NetworkManager, becase I want to:

  1. Learn to do things in the “Fedora Way”
  2. Duplicate the Network setup to my first personal Notebook (a n-th hand Dell Vostro 3350 upgraded to 8GB memory+256GB SSD, but sadly not supporting UEFI. Still can run a few KVM guests.)
  3. Now my Dell Notebook become my playground, my Fedora Desktop can take up more “production” roles.

My Desktop setup is in systemd-networkd, as I can Google more configuration examples that I can “copy and paste”.

Yes, I leave NM running to manage the Wifi adaptor only - iwd+systemd-networkd in Fedora is still too hard for me. In case I mess up with the Network setting too much, I can fireup my Wifi connection via NM to resume Internet Access quickly.

Base on my limited experience, I intended to stick with systemd-networkd for my vLAN Trunk, systemctl wg-quick@.service for WireGuard and NM for Wifi at my Desktop. Once I managed to use iwd+networkd, I will disable NM.

While for my Notebook, I will try to use NM only + wg-quick for WireGuard.

My main use case is to learn Linux / Fedora.

Years ago, I converted a Windows MSSQL cluster w/ DAS + Terminal Server front ends to VMWare cluster w/ iSCSI + Virtualized TS, then further split TS to one instance per Language Group in the same VMWare cluster.

This is my IT skill background, and that is why I play with KVM/iSCSI/vLAN a lot.

My “production” use for my Desktop in mind are:

  • provide Windows VM for RDP access, for my kids school needs (so far there is none)
  • provide dedicated Windows VM for my wife - she is not even willing to try using macOS with her iPhone
  • consolidate all Photos / Videos taken by mobile phones. Allow easy access to the archive so that they can be searched, tagged, etc.
  • as a Storage Server so that Notebooks can store backups
  • Allow iPhone / Android to do sync

It will take me years to get those done, but I will keep trying.

1 Like