WSL PING“系统错误”

WSL PING“系统错误”

我在 WSL2、Ubuntu 20.04 发行版中遇到了一个奇怪的 PING 错误。当我执行 nslookup 时 - 一切正常:

root@i:~# nslookup google.com
Server:         172.19.224.1
Address:        172.19.224.1#53

Non-authoritative answer:
Name:   google.com
Address: 142.250.185.206
Name:   google.com
Address: 2a00:1450:4001:830::200e

root@i:~#

当我通过地址 ping 时-也可以:

root@i:~# ping 142.250.185.206
PING 142.250.185.206 (142.250.185.206) 56(84) bytes of data.
64 bytes from 142.250.185.206: icmp_seq=1 ttl=113 time=45.9 ms
64 bytes from 142.250.185.206: icmp_seq=2 ttl=113 time=45.1 ms
64 bytes from 142.250.185.206: icmp_seq=3 ttl=113 time=45.1 ms
^C
--- 142.250.185.206 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 45.066/45.382/45.941/0.396 ms
root@i:~#

但是当我尝试通过名称进行 PING 时出现错误:

root@i:~# ping google.com
ping: google.com: System error
root@i:~#

Strace 告诉我有关“拒绝访问”的信息,但是什么可以拒绝此访问?找不到任何相关信息。 https://pastebin.com/SpDZuX1c- strace 出现错误

openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
stat("/etc/resolv.conf", 0x7ffea50eddb0) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/etc/host.conf", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)

真的很奇怪。

所有文件都必须可访问:

root@i:~# stat /etc/resolv.conf
  File: /etc/resolv.conf
  Size: 198             Blocks: 8          IO Block: 4096   regular file
Device: 810h/2064d      Inode: 90071       Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-02-04 16:14:10.859833659 +0300
Modify: 2022-02-04 15:43:48.419820525 +0300
Change: 2022-02-04 15:43:48.419820525 +0300
 Birth: -
root@i:~# stat /usr/bin/ping
  File: /usr/bin/ping
  Size: 72776           Blocks: 144        IO Block: 4096   regular file
Device: 810h/2064d      Inode: 7392        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-02-04 10:43:28.684002234 +0300
Modify: 2020-01-31 02:11:23.000000000 +0300
Change: 2022-02-04 10:43:21.754002185 +0300
 Birth: -
root@i:~#
root@i:~# getcap /usr/bin/ping
/usr/bin/ping = cap_net_raw+ep
root@i:~#

从 root 运行 PING。
无法启用 auditd,因为它是 WSL。

curl、traceroute、nslookup、telnet - 一切都运行正常,只有 PING 有问题。
我完全糊涂了,不知道该去哪里找,该修复什么。

相关内容