我已经在 Debian 9.6 框上设置了两个桥接设备并systemctl status networking.service
声称桥接br1
未设置,即使在启动后它实际上很好:
% systemctl status networking.service
● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-12-23 17:27:22 CET; 5min ago
Docs: man:interfaces(5)
Process: 591 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 586 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (code=exited, status=0/SUCCESS)
Main PID: 591 (code=exited, status=1/FAILURE)
Dec 23 17:27:21 irys systemd[1]: Starting Raise network interfaces...
Dec 23 17:27:21 irys ifup[591]: Waiting for br1 to get ready (MAXWAIT is 60 seconds).
Dec 23 17:27:22 irys ifup[591]: Waiting for br0 to get ready (MAXWAIT is 60 seconds).
Dec 23 17:27:22 irys ifup[591]: RTNETLINK answers: File exists
Dec 23 17:27:22 irys ifup[591]: ifup: failed to bring up br0
Dec 23 17:27:22 irys systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Dec 23 17:27:22 irys systemd[1]: Failed to start Raise network interfaces.
Dec 23 17:27:22 irys systemd[1]: networking.service: Unit entered failed state.
Dec 23 17:27:22 irys systemd[1]: networking.service: Failed with result 'exit-code'.
启动后:
% brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00259086c729 no enp6s0
br1 8000.00259086c728 no enp5s0
我的接口设置:
% cat interfaces
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp5s0
allow-hotplug enp6s0
auto br1
iface br1 inet static
address 192.168.1.212
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
dns-search example.com
bridge_ports enp5s0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
bridge_maxwait 60
auto br0
iface br0 inet static
address 10.0.0.9
netmask 255.0.0.0
network 10.0.0.0
broadcast 10.255.255.255
gateway 10.0.0.254
dns-search example.com
bridge_ports enp6s0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
所有网络、使用网络的服务均运行良好。
我该如何解决这个问题?我的意思是,为什么systemctl
声称br0
在提出时br1
没有任何问题?
PS 在journalctl -b
输出中我发现了这一点:
Dec 23 17:27:22 irys ifup[591]: Waiting for br0 to get ready (MAXWAIT is 60 seconds).
Dec 23 17:27:22 irys kernel: IPv6: ADDRCONF(NETDEV_UP): br0: link is not ready
Dec 23 17:27:22 irys ifup[591]: RTNETLINK answers: File exists
Dec 23 17:27:22 irys ifup[591]: ifup: failed to bring up br0
答案1
您可能需要刷新 br0。这对我有用:
sudo ip addr flush dev br0
答案2
答案3
从另一个接口删除重复的 IP 地址,然后刷新桥接接口,这个问题就解决了。