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

即为配置成功

相关推荐
Johny_Zhao9 小时前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
chlk1232 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑2 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash2 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI3 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行4 天前
Linux和window共享文件夹
linux
木心月转码ing4 天前
WSL+Cpp开发环境配置
linux
崔小汤呀5 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端