wsl联通外网

  1. 在C:\Users<你的用户名>下,新建.wslconfig文件

  2. 添加如下配置(具体配置参考官方文档):

    Settings apply across all Linux distros running on WSL 2

    [wsl2]

    Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB

    memory=8GB

    Sets the VM to use two virtual processors

    processors=8

    [experimental]
    autoMemoryReclaim=gradual # 开启自动回收内存,可在 gradual, dropcache, disabled 之间选择
    networkingMode=mirrored # 开启镜像网络
    dnsTunneling=true # 开启 DNS Tunneling
    firewall=true # 开启 Windows 防火墙
    autoProxy=true # 开启自动同步代理
    sparseVhd=true # 开启自动释放 WSL2 虚拟硬盘空间

  3. 重启 WSL 实例
    在 Windows PowerShell 中输入

powershell 复制代码
wsl --shutdown

在wsl环境里测试一下

powershell 复制代码
curl -v www.google.com

即为配置成功

相关推荐
乱蜂朝王2 小时前
Ubuntu 20.04安装CUDA 11.8
linux·运维·ubuntu
梁洪飞3 小时前
clk学习
linux·arm开发·嵌入式硬件·arm
~光~~3 小时前
【嵌入式linux驱动——点亮led】基于鲁班猫4 rk3588s
linux·点灯·嵌入式linux驱动
yuanmenghao4 小时前
车载Linux 系统问题定位方法论与实战系列 - 车载 Linux 平台问题定位规范
linux·运维·服务器·网络·c++
qq_589568105 小时前
centos6.8镜像源yum install不成功,无法通过镜像源下载的解决方式
linux·运维·centos
weixin_516023076 小时前
linux下fcitx5拼音的安装
linux·运维·服务器
hunter14506 小时前
Linux 进程与计划任务
linux·运维·服务器
楼田莉子6 小时前
Linux学习之磁盘与Ext系列文件
linux·运维·服务器·c语言·学习
陌上花开缓缓归以6 小时前
linux 怎么模拟系统panic重启
linux·运维·服务器
KL's pig/猪头/爱心/猪头7 小时前
写一个rv1106的led驱动3-功能函数编写
linux·驱动开发·rv1106