在我定义了一个静态 IP 后,我的网络设置出现了问题。我花了一段时间才让它再次工作,但现在出现了一些奇怪的症状。其中之一是无法再解析 dns。我可以ping google.com
毫无问题,但 ping microsoft.com、godaddy.com 甚至 8.8.8.8 让我ping: connect: Network is unreachable
这台机器是 I7、32Gb 内存,运行 Ubuntu 服务器 20.04,大部分是无头的。使用 ssh。
我网络上的其他设备没有问题。
$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:22:f6:ee:c8 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.101 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 2a02:14c:805f:ffc5:1ac0:4dff:fe41:3e93 prefixlen 64 scopeid 0x0<global>
inet6 fe80::1ac0:4dff:fe41:3e93 prefixlen 64 scopeid 0x20<link>
ether 18:c0:4d:41:3e:93 txqueuelen 1000 (Ethernet)
RX packets 331527 bytes 83760648 (83.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 182973 bytes 52213897 (52.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0x53200000-53220000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 209338 bytes 12397801 (12.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 209338 bytes 12397801 (12.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我的 /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
$ netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eno1
/etc/netplan/00-installer-config.yaml
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses: ['192.168.1.101/24']
nameservers:
addresses: [8.8.8.8, 8.8.4.4, 192.168.1.1, 212.143.0.1, 194.90.0.1, '2a02:148::1', '2a02:149::>
任何想法出了什么问题以及如何解决它?
顺便说一句,ping IP6 地址确实有效!