我正在尝试为每个 VLAN 配置一个网桥(没有 VLAN 过滤),以便systemd-networkd
在 Debian 12 上轻松配置 libvirt 虚拟机。
在没有 VLAN 的情况下,这确实可以按预期工作,并且在一些手动帮助下也可以在 VLAN 上工作 ( ip link set master ...
)。问题症状是确实systemd-networkd
创建了网桥和 VLAN 接口,但没有连接它们:
2: onbunten: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master brlan state UP group default qlen 1000
link/ether 04:92:26:b7:a9:9f brd ff:ff:ff:ff:ff:ff
4: brlan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether c6:50:f5:f2:22:8c brd ff:ff:ff:ff:ff:ff
inet 192.168.2.222/24 brd 192.168.2.255 scope global brlan
valid_lft forever preferred_lft forever
5: brvlan2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 46:ba:f7:a8:3d:d7 brd ff:ff:ff:ff:ff:ff
6: brvlan3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 26:96:9b:cc:69:af brd ff:ff:ff:ff:ff:ff
7: onbunten.4@onbunten: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 04:92:26:b7:a9:9f brd ff:ff:ff:ff:ff:ff
8: onbunten.2@onbunten: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 04:92:26:b7:a9:9f brd ff:ff:ff:ff:ff:ff
9: onbunten3@onbunten: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 04:92:26:b7:a9:9f brd ff:ff:ff:ff:ff:ff
onbunten.2
/图案差异onbunten3
是故意的;测试这是否有任何区别。
我在互联网上找到了描述,似乎表明我所做的就是解决方案。我还找到了这样的说法
此配置已弃用,不再受支持
在这个网站上(答案);不幸的是,没有明确的解释到底什么应该被弃用(我在 Systemd 手册页中没有找到任何此类提示)。
我一直systemd-networkd
在调试模式 ( SYSTEMD_LOG_LEVEL=debug
) 下运行,但在 500 行日志记录中,我没有注意到任何与 VLAN 和桥接接口同时相关的内容。没有错误消息。
配置文件
这就是有效的
==> 31-brlan.netdev <==
[NetDev]
Name=brlan
Kind=bridge
==> 32-brvlan2.netdev <==
[NetDev]
Name=brvlan2
Kind=bridge
==> 33-brvlan3.netdev <==
[NetDev]
Name=brvlan3
Kind=bridge
==> 41-onbunten-vlans.network <==
[Match]
Type=ether
Name=onbunten
[Network]
LinkLocalAddressing=no
VLAN=onbunten.2
VLAN=onbunten3
VLAN=onbunten.4
Bridge=brlan
==> 61-brlan-onbunten.network <==
[Match]
Name=onbunten
[Network]
Bridge=brlan
==> 71-brlan.network <==
[Match]
Name=brlan
[Network]
LinkLocalAddressing=no
ConfigureWithoutCarrier=yes
IgnoreCarrierLoss=yes
[Address]
Address=192.168.2.222/24
这是行不通的
==> 62-brvlan2-onbunten2.network <==
[Match]
Name=onbunten.2
[Network]
Bridge=brvlan2
==> 63-brvlan3-onbunten3.network <==
[Match]
Name=onbunten3
[Network]
Bridge=brvlan3
==> 72-brvlan2.network <==
[Match]
Name=brvlan2
[Network]
DHCP=no
LinkLocalAddressing=no
# Gateway=192.168.115.1
# NTP=
ConfigureWithoutCarrier=yes
IgnoreCarrierLoss=yes
[Address]
Address=192.168.115.222/24
DuplicateAddressDetection=ipv4
Scope=global
==> 73-brvlan3.network <==
[Match]
Name=brvlan3
[Network]
DHCP=no
LinkLocalAddressing=no
Gateway=192.168.116.1
# NTP=
ConfigureWithoutCarrier=yes
IgnoreCarrierLoss=yes
[Address]
Address=192.168.116.222/24
DuplicateAddressDetection=ipv4
Scope=global