网络在“配置”中留下桥接主界面

网络在“配置”中留下桥接主界面

我使用 netplan 和 systemd-networkd 在 Ubuntu 22.04 服务器上配置 KVM 桥。桥接器可以工作,但 networkctl 在 status 中显示主界面configuring。除此之外,这会导致systemd-networkd-wait-online.我可以通过显式请求桥接接口来解决超时问题systemd-networkd-wait-online,但我的网络设置似乎仍然不“理想”。我尝试了无数的方法,但无法让主界面进入configured状态。

这是我的系统设置:

#> apt-show-versions|grep '^systemd:\|^networkd-dispatcher:\|^netplan\.io'
netplan.io:amd64/jammy-updates 0.105-0ubuntu2~22.04.3 uptodate
networkd-dispatcher:all/jammy-security 2.1-2ubuntu0.22.04.2 uptodate
systemd:amd64/jammy-updates 249.11-0ubuntu3.10 uptodate

#> networkctl list
IDX LINK   TYPE     OPERATIONAL SETUP      
  1 lo     loopback carrier     unmanaged
  2 eno1   ether    enslaved    configuring
  3 kvmbr0 bridge   routable    configured 

#> networkctl status -a
● 1: lo                         
                     Link File: n/a
                  Network File: n/a
                          Type: loopback
                         State: carrier (unmanaged)
                  Online state: unknown
                    HW Address: 00:00:00:00:00:00
                           MTU: 65536
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
          Queue Length (Tx/Rx): 1/1
                       Address: 127.0.0.1
                                ::1
             Activation Policy: up
           Required For Online: yes

Oct 03 11:56:41 hyades systemd-networkd[1201]: lo: Link UP
Oct 03 11:56:41 hyades systemd-networkd[1201]: lo: Gained carrier

● 2: eno1                       
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: /run/systemd/network/10-netplan-eno1.network
                          Type: ether
                         State: enslaved (configuring)
                  Online state: unknown
             Alternative Names: enp0s31f6
                          Path: pci-0000:00:1f.6
                        Driver: e1000e
                        Vendor: Intel Corporation
                         Model: Ethernet Connection (7) I219-LM
                    HW Address: b4:2e:99:ca:58:58 (GIGA-BYTE TECHNOLOGY CO.,LTD.)
                           MTU: 1500 (min: 68, max: 9000)
                         QDisc: pfifo_fast
                        Master: kvmbr0
  IPv6 Address Generation Mode: none
          Queue Length (Tx/Rx): 1/1
              Auto negotiation: yes
                         Speed: 1Gbps
                        Duplex: full
                          Port: tp
                           DNS: 185.12.64.1
                                185.12.64.2
                Search Domains: your-server.de
             Activation Policy: up
           Required For Online: no

Oct 03 11:56:42 hyades systemd-networkd[1201]: eno1: Link UP
Oct 03 11:56:45 hyades systemd-networkd[1201]: eno1: Gained carrier
Oct 03 11:56:46 hyades systemd-networkd[1201]: eno1: Lost carrier
Oct 03 11:56:46 hyades systemd-networkd[1201]: eno1: DHCPv4 connection considered critical, ignoring request to reconfigure it.
Oct 03 11:56:49 hyades systemd-networkd[1201]: eno1: Gained carrier

● 3: kvmbr0                     
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: /run/systemd/network/10-netplan-kvmbr0.network
                          Type: bridge
                         State: routable (configured)
                  Online state: online
                        Driver: bridge
                    HW Address: b4:2e:99:ca:58:58 (GIGA-BYTE TECHNOLOGY CO.,LTD.)
                           MTU: 1500 (min: 68, max: 65535)
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
                 Forward Delay: 1s
                    Hello Time: 2s
                       Max Age: 12s
                   Ageing Time: 5min
                      Priority: 32768
                           STP: no
        Multicast IGMP Version: 2
                          Cost: 1200
                    Port State: disabled
          Queue Length (Tx/Rx): 1/1
              Auto negotiation: no
                         Speed: 10Gbps
                       Address: 188.40.40.198
                                2a01:4f8:173:803::2
                                fe80::b62e:99ff:feca:5858
                       Gateway: 188.40.40.193
                                fe80::1
                           DNS: 185.12.64.1
                                8.8.8.8
                                2001:4860:4860::8888
             Activation Policy: up
           Required For Online: yes
             DHCP6 Client DUID: DUID-EN/Vendor:0000ab1173d2e97f7594b7b60000

Oct 03 11:56:41 hyades systemd-networkd[1201]: kvmbr0: netdev ready
Oct 03 11:56:41 hyades systemd-networkd[1201]: kvmbr0: Link UP
Oct 03 11:56:45 hyades systemd-networkd[1201]: kvmbr0: Gained carrier
Oct 03 11:56:46 hyades systemd-networkd[1201]: kvmbr0: Gained IPv6LL
Oct 03 11:56:47 hyades systemd-networkd[1201]: kvmbr0: Lost carrier
Oct 03 11:56:49 hyades systemd-networkd[1201]: kvmbr0: Gained carrier

这是我的设置:

#> cat /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd

  ethernets:
    eno1:
      dhcp4: no
      dhcp6: no
      critical: false
      optional: true
      nameservers:
        search: []

  bridges:
    kvmbr0:
      macaddress: b4:2e:99:ca:58:58
      interfaces: [eno1]
      dhcp4: no
      dhcp6: no
      # The network settings can be found in robot.your-server.de by hovering
      # the IP entry with the mouse. Main IP address of the server, and netmask
      # in CIDR notation, where netmask 255.255.255.192 becomes /26.
      addresses:
        - 188.40.40.198/26
        - 2a01:4f8:173:803:0000::2/64
      routes:
        # Default IPv4 route:
        - to: default
          via: 188.40.40.193
          on-link: true
        # Default IPv6 route:
        - to: default
          via: "fe80::1"
          on-link: true
      nameservers:
        search: []
        addresses:
          - 185.12.64.1
          - 8.8.8.8
          - 2001:4860:4860::8888
      parameters:
        # Spanning Tree Protocol removes loops in network trees. Turn off if
        # there are guaranteed no loops:
        stp: false
        forward-delay: 1
        hello-time: 2
        max-age: 12

#> cat /run/systemd/network/*
[Match]
Name=eno1

[Link]
RequiredForOnline=no

[Network]
DHCP=ipv4
LinkLocalAddressing=no
DNS=185.12.64.1
DNS=185.12.64.2
Domains=your-server.de
Bridge=kvmbr0

[DHCP]
CriticalConnection=true
ClientIdentifier=mac
RouteMetric=100
UseMTU=true
[NetDev]
Name=kvmbr0
MACAddress=b4:2e:99:ca:58:58
Kind=bridge

[Bridge]
ForwardDelaySec=1
HelloTimeSec=2
MaxAgeSec=12
STP=false
[Match]
Name=kvmbr0

[Link]
MACAddress=b4:2e:99:ca:58:58

[Network]
LinkLocalAddressing=ipv6
Address=188.40.40.198/26
Address=2a01:4f8:173:803:0000::2/64
DNS=185.12.64.1
DNS=8.8.8.8
DNS=2001:4860:4860::8888
ConfigureWithoutCarrier=yes

[Route]
Destination=0.0.0.0/0
Gateway=188.40.40.193
GatewayOnLink=true

[Route]
Destination=::/0
Gateway=fe80::1
GatewayOnLink=true

我在 中有一个后置脚本/etc/networkd-dispatcher/routable.d/50-ifup-hooks-ethtool,但删除它并没有改变任何内容:

cat /etc/networkd-dispatcher/routable.d/50-ifup-hooks-ethtool
#!/bin/sh

# Fix a problem with the e1000e ethernet card:
ethtool -K eno1 gso off gro off tso off tx off rx off || true

相关内容