我终于从 16.04 升级到了 18.04,系统无法再连接到互联网。LAN 和 WLN 已连接,但没有互联网。我尝试了各种设置,但这里推荐的设置都不适用,而且已经浪费了 4 天时间。我该怎么办?
ping Google DNS(8.8.8.8)的终端响应:
ich@ThinkPad-Edge:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=28.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=27.2 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=115 time=22.5 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=115 time=23.5 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=115 time=22.7 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=115 time=24.9 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=115 time=26.7 ms
64 bytes from 8.8.8.8: icmp_seq=8 ttl=115 time=22.0 ms
64 bytes from 8.8.8.8: icmp_seq=9 ttl=115 time=22.7 ms
64 bytes from 8.8.8.8: icmp_seq=10 ttl=115 time=25.1 ms
64 bytes from 8.8.8.8: icmp_seq=11 ttl=115 time=24.8 ms
64 bytes from 8.8.8.8: icmp_seq=12 ttl=115 time=25.3 ms
64 bytes from 8.8.8.8: icmp_seq=13 ttl=115 time=25.1 ms
64 bytes from 8.8.8.8: icmp_seq=14 ttl=115 time=23.3 ms
64 bytes from 8.8.8.8: icmp_seq=15 ttl=115 time=27.5 ms
..如此反复,无限持续..
ich@ThinkPad-Edge:~$ ip addr
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: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 60:eb:69:d1:4d:89 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 8c:a9:82:2c:05:36 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.2/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
valid_lft 2381sec preferred_lft 2381sec
inet6 fe80::2b16:833c:a473:e0ec/64 scope link noprefixroute
valid_lft forever preferred_lft forever
ich@ThinkPad-Edge:~$
新的:
ich@ThinkPad-Edge:~$ nslookup google.com
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find google.com: SERVFAIL
答案1
我在 18.04 中也遇到了 DNS 问题。以下是我修复它们的方法。
sudo rm -f /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
不幸的是,我不记得来源了,但很可能是这个网站上的问答。
答案2
问题出在:/etc/NetworkManager/NetworkManager.conf 文件中。有一行必须用 # 注释掉 (dns=dnsmasq)。重启后,机器可以连接到互联网。非常感谢您的所有建议!
答案3
同时nameserver 127.0.0.53
您还应该有search gatewayIP
。为了使它永久生效,请编辑 /etc/resolvconf/resolv.conf.d/head 并添加缺失的部分。