2 个新的 Ubuntu Server 20.04 安装(1 个在 Hyper-V 上,1 个在裸机上)在引导时无法正确启动桥接接口。手动运行netplan apply将成功启动网桥(目前在引导时在 crontab 中作为一种解决方法)。
在我看来,在应用 IP 或运营商启动之前正在应用网桥上的网关并因此出错?纯粹是猜测,但考虑到它在应用后启动时工作正常,肯定看起来像是某种竞争条件。
任何帮助,将不胜感激。netplan 配置和输出如下。
/etc/netplan/50-netinit-config.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
bridges:
br0:
interfaces: [eth0]
dhcp4: no
addresses: [192.168.1.220/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
search: [blah.net.au]
ifconfig -a
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:15:5d:86:b8:01 txqueuelen 1000 (Ethernet)
RX packets 1406 bytes 136275 (136.2 KB)
RX errors 0 dropped 581 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:15:5d:86:b8:01 txqueuelen 1000 (Ethernet)
RX packets 1918 bytes 213299 (213.2 KB)
RX errors 0 dropped 190 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 560 bytes 43120 (43.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 560 bytes 43120 (43.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
网络统计 -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
networkctl -a 状态
1: lo
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: loopback
State: carrier (unmanaged)
MTU: 65536
Queue Length (Tx/Rx): 1/1
Address: 127.0.0.1
2: eth0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /run/systemd/network/10-netplan-eth0.network
Type: ether
State: enslaved (configured)
Path: acpi-VMBUS:00
Driver: hv_netvsc
HW Address: 00:15:5d:86:b8:01 (Microsoft Corporation)
MTU: 1500 (min: 68, max: 65521)
Queue Length (Tx/Rx): 64/64
Auto negotiation: no
Speed: 1Gbps
Duplex: full
May 03 21:25:55 seraph-test systemd-networkd[759]: eth0: Link UP
May 03 21:25:56 seraph-test systemd-networkd[759]: eth0: Gained carrier
3: br0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /run/systemd/network/10-netplan-br0.network
Type: bridge
State: carrier (failed)
Driver: bridge
HW Address: 00:15:5d:86:b8:01 (Microsoft Corporation)
MTU: 1500 (min: 68, max: 65535)
Forward Delay: 15s
Hello Time: 2s
Max Age: 20s
Ageing Time: 5min
Priority: 32768
STP: no
Multicast IGMP Version: 2
Queue Length (Tx/Rx): 1/1
DNS: 8.8.8.8
8.8.4.4
Search Domains: teese.net.au
May 03 21:25:55 seraph-test systemd-udevd[502]: br0: Could not generate persistent MAC: No data available
May 03 21:25:55 seraph-test systemd-networkd[759]: br0: netdev ready
May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Link UP
May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Gained carrier
May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Lost carrier
May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Could not set route: Nexthop has invalid gateway. Network is unreachable
May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Failed
May 03 21:25:56 seraph-test systemd-networkd[759]: br0: Gained carrier
感谢您提出这个问题并详细描述它!
我认为您在这里看到的是 br0 在 eth0 准备好/启动之前提出了运营商 (+LOWER_UP),如下所述:https ://bugs.launchpad.net/ubuntu/+source/systemd/+错误/1860926
如果从此 PPA 安装 systemd 可以解决您的问题,您可以试试吗?https://launchpad.net/~ddstreet/+archive/ubuntu/lp1860926
我们正在实际的 systemd 包中实施修复。
最好的,卢卡斯