0

I am trying to create an ethernet bridge with systemd-networkd so KVM guests can access the network. I am on Debian 11 Bullseye, attempting to create bridge "host1" on physical device "eno1".

root@debian-kvm:/etc/systemd/network# ls
    
20-wired.network  host1.netdev  host1.network  uplink.network

root@debian-kvm:/etc/systemd/network# cat 20-wired.network

[Match]
Name=eno1

[Network]
DHCP=No
Address=192.168.1.57/24
Gateway=192.168.1.1
DNS=1.1.1.1

root@debian-kvm:/etc/systemd/network# cat host1.netdev

[Netdev]
Name=host1
Kind=bridge

root@debian-kvm:/etc/systemd/network# cat host1.network

[Match]
Name=host1

[Network]
Address=192.168.1.2/24
Gateway=192.168.1.1
DNS=1.1.1.1

root@debian-kvm:/etc/systemd/network# cat uplink.network

[Match]
Name=eno1

[Network]
Bridge=host1

However, it's not working when I do "systemctl restart systemd-networkd". eno1 is fine and retains the network connection, and I can ping websites and IP addresses, but the bridge host1 never shows up.

root@debian-kvm:/etc/systemd/network# networkctl

IDX LINK TYPE     OPERATIONAL SETUP
  1 lo   loopback carrier     unmanaged
  2 eno1 ether    routable    configured
  3 eno2 ether    off         unmanaged
  4 eno3 ether    off         unmanaged
  5 eno4 ether    off         unmanaged

root@debian-kvm:/etc/systemd/network# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether b8:ca:3a:64:65:88 brd ff:ff:ff:ff:ff:ff
    altname enp1s0f0
3: eno2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:ca:3a:64:65:89 brd ff:ff:ff:ff:ff:ff
    altname enp1s0f1
4: eno3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:ca:3a:64:65:8a brd ff:ff:ff:ff:ff:ff
    altname enp1s0f2
5: eno4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:ca:3a:64:65:8b brd ff:ff:ff:ff:ff:ff
    altname enp1s0f3

As far as I can tell, it should work. The files are in /etc/systemd/network which takes highest priority, there is a .netdev file with the correct syntax and name, there's an uplink.network file indicating that the parent is eno1, and there's a host1.network file that configures the IP, DNS, etc. moving host1.network to 25-wired.network doesn't help either, so it doesn't seem to be the filenames.

In case it's something in /etc/network/interfaces, but I don't think systemd-networkd reads this file:

root@debian-kvm:/etc/systemd/network# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eno1
iface eno1 inet manual

# KVM Host interface, use this to avoid conflicts, physical device is just for physical connection
iface host1 inet manual

# FreeBSD KVM bridge
#iface frbsd1 inet static
#   bridge_ports eno1
#   address 192.168.1.45
#   broadcast 192.168.1.255
#   netmask 255.255.255.0
#   gateway 192.168.1.1

I know I could just create an init script to create a bridge every boot, but that's a bit hacky and I want to fix the problem the sustainable way.

What is happening here and how can I fix it to create the bridge properly?

2
  • firstly, It should be [NetDev] instead of [Netdev] in the file host1.netdev Commented Nov 4, 2021 at 10:56
  • @wangkaibule Oh...That's ridiculously simple and worked. Thanks for the answer. Commented Nov 14, 2021 at 2:53

1 Answer 1

0

As wangkaibule mentioned in the question comments, I should have put [NetDev] and not [Netdev].

For anyone in similar situations, systemd config files are case-sensitive - make sure everything is typed correctly with the right case, or it won't work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .