我找不到这个问题的答案,也无法自己解决。我是三次启动 Ubuntu/Kali/Windows 11。互联网在 Ubuntu 和 Windows 上运行完全正常,但当涉及到 Kali Linux 时,即使连接了 wifi,我也无法使用互联网。
该命令ping -c3 8.8.8.8
成功运行,但当我 ping 一个网站(例如 google.com)时,它返回ping: www.google.com: Name or service not known
.当我打开 VPN 或使用 Tor 浏览器时,可以访问互联网。但是如果我只使用firefox,它就无法连接
当我打开VPN时,我可以ping通www.google.com
,否则我不能。
我的/etc/resolv.conf文件:
nameserver 8.8.8.8
当我运行命令(以 root 身份)时:for t in filter nat mangle raw security; do echo "Table '$t'" ; iptables -t "$t" -nvL 2>/dev/null; echo; done
.我得到:
Table 'filter'
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Table 'nat'
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Table 'mangle'
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Table 'raw'
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Table 'security'
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
当我运行命令时grep hosts /etc/nsswitch.conf
,我得到:
hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname
答案1
运行该命令grep hosts /etc/nsswitch.conf
会给出以下条目:
hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname
外表[!UNAVAIL=return]
可疑;它表示如果热门名称/地址查找服务不可用,则返回。但不幸的是,这是在使用 DNS 查找之前。
小心地尝试删除它,所以该行变为如下:
hosts: files mdns4_minimal [NOTFOUND=return] dns