在 Ubuntu 子系统中,通过 cat /etc/resolv.conf 查看 DNS 服务器 IP,如下所示,IP为10.255.255.254
~$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:# [network]# generateResolvConf = false
nameserver 10.255.255.254
~$ ping google.com
PING google.com (198.18.0.78)56(84) bytes of data.
64 bytes from 198.18.0.78 (198.18.0.78): icmp_seq=1ttl=63time=1.89 ms
64 bytes from 198.18.0.78 (198.18.0.78): icmp_seq=2ttl=63time=1.08 ms
64 bytes from 198.18.0.78 (198.18.0.78): icmp_seq=3ttl=63time=1.26 ms
64 bytes from 198.18.0.78 (198.18.0.78): icmp_seq=4ttl=63time=1.12 ms
64 bytes from 198.18.0.78 (198.18.0.78): icmp_seq=5ttl=63time=1.31 ms
64 bytes from 198.18.0.78 (198.18.0.78): icmp_seq=6ttl=63time=0.586 ms
64 bytes from 198.18.0.78 (198.18.0.78): icmp_seq=7ttl=63time=0.735 ms