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.networkroot@debian-kvm:/etc/systemd/network# cat 20-wired.network[Match]Name=eno1[Network]DHCP=NoAddress=192.168.1.57/24Gateway=192.168.1.1DNS=1.1.1.1root@debian-kvm:/etc/systemd/network# cat host1.netdev[Netdev]Name=host1Kind=bridgeroot@debian-kvm:/etc/systemd/network# cat host1.network[Match]Name=host1[Network]Address=192.168.1.2/24Gateway=192.168.1.1DNS=1.1.1.1root@debian-kvm:/etc/systemd/network# cat uplink.network[Match]Name=eno1[Network]Bridge=host1However, 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# networkctlIDX 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 unmanagedroot@debian-kvm:/etc/systemd/network# ip link1: 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:002: 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 enp1s0f03: 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 enp1s0f14: 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 enp1s0f25: 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 enp1s0f3As 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 interfaceauto loiface lo inet loopback# The primary network interfaceallow-hotplug eno1iface eno1 inet manual# KVM Host interface, use this to avoid conflicts, physical device is just for physical connectioniface 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.1I 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?
- 1firstly, It should be
[NetDev]instead of[Netdev]in the file host1.netdevwangkaibule– wangkaibule2021-11-04 10:56:15 +00:00CommentedNov 4, 2021 at 10:56 - @wangkaibule Oh...That's ridiculously simple and worked. Thanks for the answer.Agniva Chaudhuri– Agniva Chaudhuri2021-11-14 02:53:09 +00:00CommentedNov 14, 2021 at 2:53
1 Answer1
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 mustlog in to answer this question.
Explore related questions
See similar questions with these tags.