“启动作业正在运行,等待网络配置”。optional:true 会跳过此步骤,但会破坏一些 docker 容器

“启动作业正在运行,等待网络配置”。optional:true 会跳过此步骤,但会破坏一些 docker 容器

我已经运行 Ubuntu 服务器一段时间了。最近,我的路由器停止向通过 LAN 连接的设备(包括我的 Ubuntu 服务器)“发送互联网”。该服务器在裸机上运行,​​它不是虚拟机。

我重新启动了路由器,并且其他设备的连接自行修复,但现在启动期间出现“启动作业正在运行,等待网络配置”。

我尝试过添加optional: true/etc/netplan/00-installer-config.yaml它确实“有效”,但它导致我的 docker 容器 (*arr suite) 无法启动。因此,删除 后optional: true,我的容器可以正常启动,但启动时间较长。

此外,当我进入服务器时,它显示“无法连接到https://changelogs.ubuntu.com/meta-release-lts. 检查您的 Internet 连接或代理设置”

我已经尝试过了,sudo apt update && sudo apt upgrade希望它能够自行修复。

以下是一些输出:

操作系统

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

网络控制

$ networkctl -a status
● 2: eno1
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: /run/systemd/network/10-netplan-eno1.network
                          Type: ether
                         State: routable (configuring)
                  Online state: online
             Alternative Names: enp0s31f6
                          Path: pci-0000:00:1f.6
                        Driver: e1000e
                        Vendor: Intel Corporation
                         Model: Ethernet Connection (7) I219-V
                    HW Address: XXX
                           MTU: 1500 (min: 68, max: 9000)
                         QDisc: fq_codel
  IPv6 Address Generation Mode: none
          Queue Length (Tx/Rx): 1/1
              Auto negotiation: yes
                         Speed: 1Gbps
                        Duplex: full
                          Port: tp
                       Address: 192.168.50.141 (DHCP4 via 192.168.50.1)
                       Gateway: 192.168.50.1
                           DNS: 1.1.1.1
                                8.8.8.8
                                8.8.4.4
                                192.168.50.1
             Activation Policy: up
           Required For Online: yes
               DHCP4 Client ID: IAID:0xb6220feb/DUID
                  Connected To: XXX on port XXX (eth4)

Jul 16 20:05:20 meowmeow-server systemd-networkd[775]: eno1: Link UP
Jul 16 20:05:23 meowmeow-server systemd-networkd[775]: eno1: Gained carrier
Jul 16 20:05:26 meowmeow-server systemd-networkd[775]: eno1: DHCPv4 address 192.168.50.141/24 via 192.168.50.1

系统日志

$ cat /var/log/syslog | grep eno1
Jul 16 20:05:20 meowmeow-server systemd-networkd[775]: eno1: Link UP
Jul 16 20:05:20 meowmeow-server kernel: [    4.171127] e1000e 0000:00:1f.6 eno1: renamed from eth0
Jul 16 20:05:23 meowmeow-server systemd-networkd[775]: eno1: Gained carrier
Jul 16 20:05:23 meowmeow-server kernel: [   10.650222] e1000e 0000:00:1f.6 eno1: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Jul 16 20:05:23 meowmeow-server kernel: [   10.650276] IPv6: ADDRCONF(NETDEV_CHANGE): eno1: link becomes ready
Jul 16 20:05:26 meowmeow-server systemd-networkd[775]: eno1: DHCPv4 address 192.168.50.141/24 via 192.168.50.1

lshw -C network

$ sudo lshw -C network
  *-network
       description: Ethernet interface
       product: Ethernet Connection (7) I219-V
       vendor: Intel Corporation
       physical id: 1f.6
       bus info: pci@0000:00:1f.6
       logical name: eno1
       version: 10
       serial: XXX
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=5.15.0-76-generic duplex=full firmware=0.5-4 ip=192.168.50.141 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:126 memory:a3300000-a331ffff

ls /etc/netplan

00-installer-config.yaml

sudo netplan get

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      addresses:
      - "192.168.50.141/24"
      nameservers:
        addresses:
        - 1.1.1.1
        - 8.8.8.8
        - 8.8.4.4
        search: []
      dhcp4: true
      dhcp6: false
      routes:
      - scope: "link"
        from: "192.168.50.1"
        to: "0.0.0.0/0"
      link-local: []

如果我不投,我就dhcp4: true得不到inet 192.168.50.141 ...ip addr show eno1

ls /etc/network

if-pre-up.d  if-up.d

ls /etc/systemd/network

EMPTY // NO OUTPUT

ip route

$ ip route show dev eno1
default via 192.168.50.1 proto dhcp src 192.168.50.141 metric 100
1.1.1.1 via 192.168.50.1 proto dhcp src 192.168.50.141 metric 100
192.168.50.0/24 proto kernel scope link src 192.168.50.141 metric 100
192.168.50.1 proto dhcp scope link src 192.168.50.141 metric 100

ip addr

$ ip addr show eno1
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether XXX brd ff:ff:ff:ff:ff:ff
    altname enp0s31f6
    inet 192.168.50.141/24 metric 100 brd 192.168.50.255 scope global dynamic eno1
       valid_lft 85298sec preferred_lft 85298sec

答案1

您通过路由器的 DHCP 获取 IP 地址,但无法从该 IP 访问互联网。这很可能是路由器配置问题。

您应该检查路由器的配置,并确保 Ubuntu 服务器上显示的 IP 地址可以访问互联网。

相关内容