【stackoverflow】WSL 里的ubuntu突然连不上网,之前还好好的

来源:No internet connection on WSL Ubuntu (Windows Subsystem for Linux)

Recently I installed WSL Ubuntu 18.04 on my Windows machine, but nothing seems to work properly, because I have no internet access.
I tried a few commands and sudo apt update says ‘Connection failed’ and ping google.com literally takes forever as you can see in this screenshot:
I also checked nano /etc/resolv.conf and made sure that the nameservers are right, completely disabled Kaspersky and its firewall, disabled Hyper-V, reinstalled WSL a few times and even disabled Windows Defender. Nothing helped.

TL;DR (also incomplete information below): sudo nano /etc/resolv.conf, put # before existing entries, add nameserver 8.8.8.8 on its own line, save (Ctrl+X; Y; Enter), ping google.com to make sure it worked, then to make sure it doesn’t get overwritten: sudo nano /etc/wsl.conf, add [network] on its own line, then generateResolvConf = false on the next line, save, and you’re done.
– Andrew Jul 11 at 23:06

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值