在实验室网络中,我尝试虚拟化一个在多个 VLAN 之间路由的路由器 [2]。虚拟机管理程序运行 Ubuntu 20.04。
但是,我只能在 Hypervisor 上设置 21 个 VLAN 桥接器。一旦我添加第 22 个 VLAN 桥接器(或更多),netplan 就会抛出错误 [1]。
这让我感到疑惑,netplan 是否只支持有限数量的 VLAN 桥?
[编辑]:这是在 netplan 上0.102-0ubuntu1~20.04.2
。Systemd 单元输出如下 [3]。更有趣的是 journald 输出,其中包括以下行:Could not enumerate addresses: No buffer space available
[4]。
[1] 尝试应用>21 VLAN桥接时出现错误:
root@test1:~# netplan apply
Job for systemd-networkd.service failed because the control process exited with error code.
See "systemctl status systemd-networkd.service" and "journalctl -xe" for details.
Traceback (most recent call last):
File "/usr/sbin/netplan", line 23, in <module>
netplan.main()
File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 264, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 55, in run
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 264, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 236, in command_apply
utils.systemctl_networkd('start', sync=True, extra_services=netplan_wpa + netplan_ovs)
File "/usr/share/netplan/netplan/cli/utils.py", line 131, in systemctl_networkd
subprocess.check_call(command)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['systemctl', 'start', 'systemd-networkd.service', 'netplan-ovs-cleanup.service']' returned non-zero exit status 1.
[2] 具有 30 个接口的完整 netplan 配置:
network:
version: 2
renderer: networkd
ethernets:
enp1s0:
dhcp4: no
dhcp6: no
addresses:
- 192.168.0.135/24
gateway4: 192.168.0.254
nameservers:
search:
- example.com
addresses:
- 192.168.0.1
- 192.168.0.2
vlans:
br0.1:
id: 1
link: br0
br0.2:
id: 2
link: br0
br0.3:
id: 3
link: br0
br0.4:
id: 4
link: br0
br0.5:
id: 5
link: br0
br0.6:
id: 6
link: br0
br0.7:
id: 7
link: br0
br0.8:
id: 8
link: br0
br0.9:
id: 9
link: br0
br0.10:
id: 10
link: br0
br0.11:
id: 11
link: br0
br0.12:
id: 12
link: br0
br0.13:
id: 13
link: br0
br0.14:
id: 14
link: br0
br0.15:
id: 15
link: br0
br0.16:
id: 16
link: br0
br0.17:
id: 17
link: br0
br0.18:
id: 18
link: br0
br0.19:
id: 19
link: br0
br0.20:
id: 20
link: br0
br0.21:
id: 21
link: br0
br0.22:
id: 22
link: br0
br0.23:
id: 23
link: br0
br0.24:
id: 24
link: br0
br0.25:
id: 25
link: br0
br0.26:
id: 26
link: br0
br0.27:
id: 27
link: br0
br0.28:
id: 28
link: br0
br0.29:
id: 29
link: br0
bridges:
br0:
interfaces:
- enp1s0
macaddress: 54:52:00:00:51:14
dhcp4: no
dhcp6: no
addresses:
- 192.168.0.249/24
gateway4: 192.168.0.254
nameservers:
search:
- example.com
addresses:
- 192.168.0.1
- 192.168.0.2
#parameters:
# forward-delay: 0
# stp: false
br1:
interfaces:
- br0.1
macaddress: 54:52:01:00:00:14
dhcp4: no
dhcp6: no
addresses:
- 10.1.0.14/24
gateway4: 10.1.0.254
nameservers:
search:
- example.com
addresses:
- 192.168.0.1
- 192.168.0.2
br2:
interfaces:
- br0.2
dhcp4: no
dhcp6: no
br3:
interfaces:
- br0.3
dhcp4: no
dhcp6: no
br4:
interfaces:
- br0.4
dhcp4: no
dhcp6: no
br5:
interfaces:
- br0.5
dhcp4: no
dhcp6: no
br6:
interfaces:
- br0.6
dhcp4: no
dhcp6: no
br7:
interfaces:
- br0.7
dhcp4: no
dhcp6: no
br8:
interfaces:
- br0.8
dhcp4: no
dhcp6: no
br9:
interfaces:
- br0.9
dhcp4: no
dhcp6: no
br10:
interfaces:
- br0.10
macaddress: 54:52:20:00:00:01
dhcp4: no
dhcp6: no
addresses:
- 10.10.0.1/24
gateway4: 10.10.0.254
nameservers:
search:
- example.com
addresses:
- 192.168.0.1
- 192.168.0.2
br11:
interfaces:
- br0.11
dhcp4: no
dhcp6: no
br12:
interfaces:
- br0.12
dhcp4: no
dhcp6: no
br13:
interfaces:
- br0.13
dhcp4: no
dhcp6: no
br14:
interfaces:
- br0.14
dhcp4: no
dhcp6: no
br15:
interfaces:
- br0.15
dhcp4: no
dhcp6: no
br16:
interfaces:
- br0.16
dhcp4: no
dhcp6: no
br17:
interfaces:
- br0.17
dhcp4: no
dhcp6: no
br18:
interfaces:
- br0.18
dhcp4: no
dhcp6: no
br19:
interfaces:
- br0.19
dhcp4: no
dhcp6: no
br20:
interfaces:
- br0.20
dhcp4: no
dhcp6: no
br21:
interfaces:
- br0.21
dhcp4: no
dhcp6: no
br22:
interfaces:
- br0.22
dhcp4: no
dhcp6: no
br23:
interfaces:
- br0.23
dhcp4: no
dhcp6: no
br24:
interfaces:
- br0.24
dhcp4: no
dhcp6: no
br25:
interfaces:
- br0.25
dhcp4: no
dhcp6: no
br26:
interfaces:
- br0.26
dhcp4: no
dhcp6: no
br27:
interfaces:
- br0.27
dhcp4: no
dhcp6: no
br28:
interfaces:
- br0.28
dhcp4: no
dhcp6: no
br29:
interfaces:
- br0.29
dhcp4: no
dhcp6: no
[3]systemd输出:
root@test1:~# systemctl status systemd-networkd.service
● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled-runtime; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-06-07 16:17:15 CEST; 2s ago
Docs: man:systemd-networkd.service(8)
Process: 63803 ExecStart=/lib/systemd/systemd-networkd (code=exited, status=1/FAILURE)
Main PID: 63803 (code=exited, status=1/FAILURE)
Error: 105 (Kein Hauptspeicher für den Puffer verfügbar)
Jun 07 16:17:15 test1 systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE
Jun 07 16:17:15 test1 systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Jun 07 16:17:15 test1 systemd[1]: Failed to start Network Service.
Jun 07 16:17:15 test1 systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 5.
Jun 07 16:17:15 test1 systemd[1]: Stopped Network Service.
Jun 07 16:17:15 test1 systemd[1]: systemd-networkd.service: Start request repeated too quickly.
Jun 07 16:17:15 test1 systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Jun 07 16:17:15 test1 systemd[1]: Failed to start Network Service.
[4]错误日志:
root@test1:~# journalctl -xe
Jun 07 16:17:14 test1 systemd[1]: Reloading.
Jun 07 16:17:14 test1 systemd[1]: Stopping Network Service...
-- Subject: A stop job for unit systemd-networkd.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit systemd-networkd.service has begun execution.
--
-- The job identifier is 3254.
Jun 07 16:17:14 test1 systemd[1]: Condition check resulted in OpenVSwitch configuration for cleanup being skipped.
-- Subject: A start job for unit netplan-ovs-cleanup.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit netplan-ovs-cleanup.service has finished successfully.
--
-- The job identifier is 3259.
Jun 07 16:17:14 test1 systemd[1]: Condition check resulted in OpenVSwitch configuration for cleanup being skipped.
-- Subject: A start job for unit netplan-ovs-cleanup.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit netplan-ovs-cleanup.service has finished successfully.
--
-- The job identifier is 3262.
Jun 07 16:17:14 test1 systemd[1]: systemd-networkd.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit systemd-networkd.service has successfully entered the 'dead' state.
Jun 07 16:17:14 test1 systemd[1]: Starting Network Service...
-- Subject: A start job for unit systemd-networkd.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit systemd-networkd.service has begun execution.
--
-- The job identifier is 3256.
Jun 07 16:17:14 test1 systemd-networkd[63781]: br9: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br8: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br7: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br6: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br5: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br4: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br3: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br29: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br28: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br27: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br26: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br25: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br24: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br23: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br22: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br21: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br20: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br2: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br19: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br18: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br17: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br16: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br15: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br14: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br13: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br12: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br11: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br10: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br1: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: br0: netdev ready
Jun 07 16:17:14 test1 systemd-networkd[63781]: Could not enumerate addresses: No buffer space available
Jun 07 16:17:14 test1 systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit systemd-networkd.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Jun 07 16:17:14 test1 systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit systemd-networkd.service has entered the 'failed' state with result 'exit-code'.
Jun 07 16:17:14 test1 systemd[1]: Failed to start Network Service.
-- Subject: A start job for unit systemd-networkd.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit systemd-networkd.service has finished with a failure.
--
-- The job identifier is 3256 and the job result is failed.
Jun 07 16:17:14 test1 systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 1.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit systemd-networkd.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Jun 07 16:17:14 test1 systemd[1]: Condition check resulted in OpenVSwitch configuration for cleanup being skipped.
-- Subject: A start job for unit netplan-ovs-cleanup.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit netplan-ovs-cleanup.service has finished successfully.
--
-- The job identifier is 3268.
(以及一堆重复的输出)。
答案1
回答我自己的问题:我想我从 2019 年开始就被这个错误所困扰:https://github.com/systemd/systemd/issues/14417。
作为一种解决方法,启用并启动 systemd-networkd 套接字似乎可以暂时缓解这个问题:
systemctl enable systemd-networkd.socket
systemctl start systemd-networkd.socket
初步测试表明,这是一个可行的解决方案,并且重启后依然有效。我将继续测试此问题,并将此答案标记为暂时已解决。