Ubuntu 20.04 Netplan Bridge 接口在启动时失败

Ubuntu 20.04 Netplan Bridge 接口在启动时失败

2 个新的 Ubuntu Server 20.04 安装(1 个在 Hyper-V 上,1 个在裸机上)在启动时无法正确启动桥接接口。正在运行申请网络计划手动将成功启动桥接器(这是当前在启动时在 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]

配置文件

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

网络状态监测

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

答案1

感谢您提出这个问题并详细描述!

我认为您在此处看到的是,在 eth0 准备就绪/启动之前,br0 已启动载波 (+LOWER_UP),如下所述:https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1860926

您可以尝试从此 PPA 安装 systemd 是否能解决您的问题?https://launchpad.net/~ddstreet/+archive/ubuntu/lp1860926

我们正在真正的 systemd 包中实施修复。

祝好,卢卡斯

相关内容