18.04 服务器网络不可达

18.04 服务器网络不可达

我的服务器一直运行良好,直到 TimeTrex(一个基于 PHP 的工资单应用程序)需要更新新的税表。安装顺利进行,但现在系统显示网络无法访问。我运行了以下检查:以 root 身份运行 cat /etc/netplan/*.yaml 的输出:

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    renderer: networkd
    ethernets:
        enp5s0:
            addresses: [192.168.1.200/24]
            gateway4: 192.168.0.1
            dhcp4: false
            nameservers:
                addresses: [8.8.8.8, 8.8.4.4]

ip addr ls 的输出:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 94:de:80:28:a2:71 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.200/24 brd 192.168.1.255 scope global enp5s0
       valid_lft forever preferred_lft forever
    inet6 fe80::96de:80ff:fe28:a271/64 scope link 
       valid_lft forever preferred_lft forever

netplan --debug generate 的输出:

** (generate:2250): DEBUG: 18:39:27.761: Processing input file /etc/netplan/01-netcfg.yaml..
** (generate:2250): DEBUG: 18:39:27.762: starting new processing pass
** (generate:2250): DEBUG: 18:39:27.762: enp5s0: setting default backend to 1
** (generate:2250): DEBUG: 18:39:27.762: Configuration is valid
** (generate:2250): DEBUG: 18:39:27.762: Generating output files..
** (generate:2250): DEBUG: 18:39:27.762: NetworkManager: definition enp5s0 is not for us (backend 1)

systemctl status systemd-networkd 的输出:

● systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2020-01-12 18:22:40 EST; 22min ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 923 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-networkd.service
           └─923 /lib/systemd/systemd-networkd

Jan 12 18:22:40 timberoakspetspa systemd[1]: Starting Network Service...
Jan 12 18:22:40 timberoakspetspa systemd-networkd[923]: Enumeration completed
Jan 12 18:22:40 timberoakspetspa systemd[1]: Started Network Service.
Jan 12 18:22:40 timberoakspetspa systemd-networkd[923]: lo: Link is not managed by us
Jan 12 18:22:45 timberoakspetspa systemd-networkd[923]: enp5s0: Gained carrier
Jan 12 18:22:45 timberoakspetspa systemd-networkd[923]: enp5s0: Could not set route: Network is unreachable
Jan 12 18:22:47 timberoakspetspa systemd-networkd[923]: enp5s0: Gained IPv6LL
Jan 12 18:22:47 timberoakspetspa systemd-networkd[923]: enp5s0: Configured

答案1

另一个团队的帮助表明 /etc/netplan/*.yaml 中的默认网关被错误更改了。

问题已解决 — 我认为。

相关内容