我的家庭服务器(运行 Ubuntu Server 20.04)无法随机连接到互联网。它本来很好,后来就不行了(我没有对它进行任何更改)。我可以在本地和通过 SSH 本地访问它。它可以 ping 8.8.8.8 并设置了静态 IP 地址。运行任何类型的“sudo apt-get update”只会返回失败的尝试。
这是我的 netplan yaml 设置:
network:
ethernets:
eno1:
dhcp4: no
dhcp6: no
bridges:
br0:
interfaces: [eno1]
dhcp4: no
addresses: [192.168.0.119/24]
gateway4: 192.168.0.1
nameservers:
addresses: [192.168.0.1, 8.8.8.8]
version: 2
这是“sudo lshw -C network”的结果。桥接器连接到已关闭的虚拟机,因此禁用是正常的。
*-network
description: Ethernet interface
product: Ethernet Connection I217-V
vendor: Intel Corporation
physical id: 19
bus info: pci@0000:00:19.0
logical name: eno1
version: 04
serial: 94:de:80:b4:8f:0b
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=3.2.6-k duplex=full firmware=0.13-4 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:28 memory:f0500000-f051ffff memory:f053d000-f053dfff ioport:f080(size=32)
*-network DISABLED
description: Ethernet interface
physical id: 2
logical name: virbr0-nic
serial: 52:54:00:e8:cd:68
size: 10Mbit/s
capabilities: ethernet physical
configuration: autonegotiation=off broadcast=yes driver=tun driverversion=1.6 duplex=full link=no multicast=yes port=twisted pair speed=10Mbit/s
尝试 ping google.com:
ping: google.com: Name or service not known
网络日志“sudo journalctl -b 0 -u NetworkManager”:
Apr 10 11:21:08 homeserver systemd[1]: Starting Network Manager...
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.6453] NetworkManager (version 1.22.10) is starting>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.6454] Read config: /etc/NetworkManager/NetworkMana>
Apr 10 11:21:08 homeserver systemd[1]: Started Network Manager.
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.6482] bus-manager: acquired D-Bus service "org.fre>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.6699] manager[0x55640f84b040]: monitoring kernel f>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.6699] monitoring ifupdown state file '/run/network>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8065] hostname: hostname: using hostnamed
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8066] hostname: hostname changed from (none) to "h>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8068] dns-mgr[0x55640f830290]: init: dns=systemd-r>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8070] manager[0x55640f84b040]: rfkill: Wi-Fi hardw>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8070] manager[0x55640f84b040]: rfkill: WWAN hardwa>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8153] Loaded device plugin: NMWifiFactory (/usr/li>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8235] Loaded device plugin: NMWwanFactory (/usr/li>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8294] Loaded device plugin: NMBluezManager (/usr/l>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8312] Loaded device plugin: NMAtmManager (/usr/lib>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8356] Loaded device plugin: NMTeamFactory (/usr/li>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8358] manager: rfkill: Wi-Fi enabled by radio kill>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8360] manager: rfkill: WWAN enabled by radio kills>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8361] manager: Networking is enabled by state file
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8362] dhcp-init: Using DHCP client 'internal'
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8385] settings: Loaded settings plugin: ifupdown (>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8385] settings: Loaded settings plugin: keyfile (i>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8385] ifupdown: management mode: unmanaged
Apr 10 11:21:08 homeserver NetworkManager[1061]: <warn> [1649607668.8396] ifupdown: interfaces file /etc/network/inter>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8428] device (lo): carrier: link connected
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8430] manager: (lo): new Generic device (/org/free>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8437] device (br0): carrier: link connected
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8439] manager: (br0): new Bridge device (/org/free>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8446] device (eno1): carrier: link connected
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8448] manager: (eno1): new Ethernet device (/org/f>
Apr 10 11:21:08 homeserver NetworkManager[1061]: <warn> [1649607668.8541] Error: failed to open /run/network/ifstate
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8606] manager: startup complete
Apr 10 11:21:08 homeserver NetworkManager[1061]: <info> [1649607668.8662] modem-manager: ModemManager available
Apr 10 11:21:09 homeserver NetworkManager[1061]: <info> [1649607669.6917] manager: (virbr0): new Bridge device (/org/f>
Apr 10 11:21:09 homeserver NetworkManager[1061]: <info> [1649607669.6947] manager: (virbr0-nic): new Tun device (/org/>
Apr 10 11:26:27 homeserver systemd[1]: Stopping Network Manager...
Apr 10 11:26:27 homeserver NetworkManager[1061]: <info> [1649607987.3531] caught SIGTERM, shutting down normally.
Apr 10 11:26:27 homeserver NetworkManager[1061]: <info> [1649607987.3540] device (eno1): released from master device b>
Apr 10 11:26:27 homeserver NetworkManager[1061]: <info> [1649607987.3546] device (virbr0-nic): released from master de>
Apr 10 11:26:27 homeserver NetworkManager[1061]: <info> [1649607987.3898] exiting (success)
Apr 10 11:26:27 homeserver systemd[1]: NetworkManager.service: Succeeded.
Apr 10 11:26:27 homeserver systemd[1]: Stopped Network Manager.
Apr 10 11:26:27 homeserver systemd[1]: Starting Network Manager...
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.4146] NetworkManager (version 1.22.10) is starting>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.4147] Read config: /etc/NetworkManager/NetworkMana>
Apr 10 11:26:27 homeserver systemd[1]: Started Network Manager.
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.4186] bus-manager: acquired D-Bus service "org.fre>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.4208] manager[0x5633ae7e6030]: monitoring kernel f>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.4209] monitoring ifupdown state file '/run/network>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5026] hostname: hostname: using hostnamed
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5026] hostname: hostname changed from (none) to "h>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5030] dns-mgr[0x5633ae7c8290]: init: dns=systemd-r>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5033] manager[0x5633ae7e6030]: rfkill: Wi-Fi hardw>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5033] manager[0x5633ae7e6030]: rfkill: WWAN hardwa>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5045] Loaded device plugin: NMWifiFactory (/usr/li>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5053] Loaded device plugin: NMWwanFactory (/usr/li>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5026] hostname: hostname: using hostnamed
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5026] hostname: hostname changed from (none) to "h>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5030] dns-mgr[0x5633ae7c8290]: init: dns=systemd-r>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5033] manager[0x5633ae7e6030]: rfkill: Wi-Fi hardw>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5033] manager[0x5633ae7e6030]: rfkill: WWAN hardwa>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5045] Loaded device plugin: NMWifiFactory (/usr/li>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5053] Loaded device plugin: NMWwanFactory (/usr/li>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5057] Loaded device plugin: NMBluezManager (/usr/l>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5060] Loaded device plugin: NMAtmManager (/usr/lib>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5067] Loaded device plugin: NMTeamFactory (/usr/li>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5070] manager: rfkill: Wi-Fi enabled by radio kill>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5071] manager: rfkill: WWAN enabled by radio kills>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5074] manager: Networking is enabled by state file
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5075] dhcp-init: Using DHCP client 'internal'
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5109] settings: Loaded settings plugin: ifupdown (>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5110] settings: Loaded settings plugin: keyfile (i>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5110] ifupdown: management mode: unmanaged
Apr 10 11:26:27 homeserver NetworkManager[6077]: <warn> [1649607987.5110] ifupdown: interfaces file /etc/network/inter>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5118] device (lo): carrier: link connected
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5121] manager: (lo): new Generic device (/org/free>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5127] device (br0): carrier: link connected
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5129] manager: (br0): new Bridge device (/org/free>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5135] device (eno1): carrier: link connected
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5139] manager: (eno1): new Ethernet device (/org/f>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5145] manager: (virbr0): new Bridge device (/org/f>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5150] manager: (virbr0-nic): new Tun device (/org/>
Apr 10 11:26:27 homeserver NetworkManager[6077]: <warn> [1649607987.5153] Error: failed to open /run/network/ifstate
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5172] manager: startup complete
Apr 10 11:26:27 homeserver NetworkManager[6077]: <info> [1649607987.5236] modem-manager: ModemManager available
我不知道接下来该怎么做。从我所看到的一切来看,一切似乎都很好,但显然存在一些脱节。
编辑:额外的研究。
猫/等/网络/接口
cat: /etc/network/interfaces: No such file or directory
cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false
[device]
wifi.scan-rand-mac-address=no
ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Aug 24 2021 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
猫/etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0 trust-ad
resolvectl 状态
Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test
Link 5 (virbr0-nic)
Current Scopes: none
DefaultRoute setting: no
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test
Link 5 (virbr0-nic)
Current Scopes: none
DefaultRoute setting: no
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Link 4 (virbr0)
Current Scopes: none
DefaultRoute setting: no
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Link 3 (br0)
Current Scopes: DNS
DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 192.168.0.1
8.8.8.8
Link 2 (eno1)
Current Scopes: none
DefaultRoute setting: no
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
答案1
好吧,这不是一个确切的答案,但重新安装操作系统(ubuntu 服务器)解决了问题。最终花在重新设置上的时间比我花在尝试解决实际问题上的时间要少。这是一个核选项,但由于对到底出了什么问题了解有限,这是最简单的选择。