Windows PS 和 WSL2 似乎无法发送 icmp echo 请求或下载任何内容

Windows PS 和 WSL2 似乎无法发送 icmp echo 请求或下载任何内容

我更新到Microsoft Windows [版本 10.0.19041.264](新的 2004 年 5 月更新)以便检查 wsl2 并查看所有新功能。我已经设置好 wsl1 并开始运行,因为我经常喜欢用它来进行 IRC。更新之前一切都运行良好。

因此我更新到了 2004,并按照 wsl2 的安装步骤进行操作(https://docs.microsoft.com/en-us/windows/wsl/install-win10),一切进展顺利。没有发生任何错误。

然后我尝试了一下sudo apt update && sudo apt full-upgrade,结果如下:

[sudo] password for USERNAME:
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

好吧……所以有问题。所以一定是无线问题,对吧?我做了lshw -C network

*-network:0
       description: Ethernet interface
       physical id: 1
       logical name: eth0
       serial: 00:15:5d:f3:23:81
       size: 10Gbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=hv_netvsc duplex=full firmware=N/A ip=172.28.70.182 link=yes multicast=yes speed=10Gbit/s
  *-network:1 DISABLED
       description: Ethernet interface
       physical id: 2
       logical name: dummy0
       serial: 0e:25:ec:70:65:ec
       capabilities: ethernet physical
       configuration: broadcast=yes driver=dummy driverversion=1.0
  *-network:2 DISABLED
       description: Ethernet interface
       physical id: 3
       logical name: bond0
       serial: da:9c:6a:d4:f2:16
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=bonding driverversion=3.7.1 firmware=2 link=no master=yes multicast=yes

所以它看起来好像看到了我的无线网卡...所以接下来我尝试了一下,ping结果得到的是Temporary failure in name resolution

我按照这里的解决方案:https://www.digitalocean.com/community/questions/how-to-resolve-temporary-failure-in-name-resolution-issue

但只有当你将以下内容写入时它才有效/etc/wsl.conf

[network]
generateResolvConf = false

因此请确保sudo nano /etc/wsl.conf将其粘贴到那里,CTRL+O 和 CTRL+X,然后退出并进入 powershell wsl --shutdown,然后重新启动它。这为我解决了这个问题。

让这成为其他遇到此问题的人的文档。

相关内容