使用 systemd-networkd 配置桥接接口

使用 systemd-networkd 配置桥接接口

我正在尝试创建一个桥接口清除Linux与 systemd-network 最终将其用于 KVM。

我尝试创建以下文件作为指导:

/etc/systemd/network/br0.netdev

[NetDev]
Name=br0
Kind=bridge

/etc/systemd/network/br0.network

[Match]
Name=br0

[Network]
Address=10.0.0.3/16
Gateway=10.0.0.1
DNS=10.0.0.1

上行网络

[Match]
Name=eno1

[Network]
Bridge=br0

重新启动后,brctl似乎暗示eno1接口未正确连接到br0

bswinnerton@nuc7i3 /etc/systemd/network $ brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.429f5774d8b6       no

这是输出networkctl

bswinnerton@nuc7i3 /etc/systemd/network $ sudo networkctl
IDX LINK             TYPE               OPERATIONAL SETUP
  1 lo               loopback           carrier     unmanaged
  2 br0              ether              no-carrier  configuring
  3 eno1             ether              routable    configured

3 links listed.

以及状态systemd-networkd

bswinnerton@nuc7i3 /etc/systemd/network $ systemctl status systemd-networkd
● systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2017-12-19 22:45:53 UTC; 8min ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 253 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-networkd.service
           └─253 /usr/lib/systemd/systemd-networkd

Dec 19 22:45:53 nuc7i3 systemd-networkd[253]: br0: netdev ready
Dec 19 22:45:53 nuc7i3 systemd-networkd[253]: Enumeration completed
Dec 19 22:45:53 nuc7i3 systemd-networkd[253]: br0: IPv6 successfully enabled
Dec 19 22:45:53 nuc7i3 systemd[1]: Started Network Service.
Dec 19 22:45:53 nuc7i3 systemd-networkd[253]: eth0: Renamed to eno1
Dec 19 22:45:53 nuc7i3 systemd-networkd[253]: eno1: IPv6 successfully enabled
Dec 19 22:45:58 nuc7i3 systemd-networkd[253]: eno1: Gained carrier
Dec 19 22:45:59 nuc7i3 systemd-networkd[253]: eno1: DHCPv4 address 10.0.0.3/24 via 10.0.0.1
Dec 19 22:46:01 nuc7i3 systemd-networkd[253]: eno1: Gained IPv6LL
Dec 19 22:46:13 nuc7i3 systemd-networkd[253]: eno1: Configured

我是否错误配置了文件?对于它的价值,我尝试过sudo brctl addbr br0sudo brctl addif br0 eno1然后sudo systemctl restart systemd-networkd,一切都按预期工作,但在重新启动之间不会持续存在。

答案1

检查/lib/systemd/network/或中的配置文件/run/systemd/network,似乎有其他配置文件与您的eno1接口匹配并在其上启动 DHCP

相关内容