我正在使用带有网络管理器的 ArchLinux 通过 wifi 连接到互联网,但有时,即使它仍然连接到 wifi,我也无法访问网站。我在网上搜索了很多,想看看这个问题的出处,但找不到解决办法。
当我 ping 我的路由器或 8.8.8.8 时,它工作正常:
$ ping -c3 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.28 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.42 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=3.01 ms
--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 1.284/1.906/3.011/0.783 ms
$ ping -c3 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=55 time=10.3 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=9.96 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=10.4 ms
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 9.964/10.218/10.423/0.190 ms
但是当我 ping google 时,它什么也不做,或者在发送一个数据包后停止:
$ ping google.com
PING google.com (216.58.204.110) 56(84) bytes of data.
^C64 bytes from 216.58.204.110: icmp_seq=1 ttl=53 time=10.9 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 10.874/10.874/10.874/0.000 ms
如果我 ping google 的 IP 地址,它会正确发送 3 个数据包:
ping -c3 216.58.204.142
PING 216.58.204.142 (216.58.204.142) 56(84) bytes of data.
64 bytes from 216.58.204.142: icmp_seq=1 ttl=53 time=10.4 ms
64 bytes from 216.58.204.142: icmp_seq=2 ttl=53 time=9.74 ms
64 bytes from 216.58.204.142: icmp_seq=3 ttl=53 time=10.5 ms
--- 216.58.204.142 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 9.740/10.224/10.512/0.344 ms
我以为问题出在文件上/etc/resolv.conf
,但它是由 Network Manager 自动生成并完成的。我无法修改它,因为我的所有更改都会被 NetworkManager 直接删除
$ cat /etc/resolv.conf
# Generated by NetworkManager
search home
nameserver 192.168.1.1
nameserver 2a01:cb08:8d09:bc00:46a6:1eff:fe24:e1e5
nameserver fe80::46a6:1eff:fe24:e1e5%wlp4s0
此外,在 NetworkManager 中,所有内容都设置为“自动”。我该如何修复它?这是 DNS 的问题吗?