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

即为配置成功

相关推荐
小周技术驿站4 分钟前
Linux 权限管理细节详解
linux·运维·服务器·ubuntu·centos
思麟呀4 分钟前
Select多路转接
linux·网络·c++·网络协议·http
cen__y30 分钟前
Linux04(重定向)
linux·服务器·c语言
senijusene1 小时前
I2C 总线框架下LM75A 温度传感器 Linux驱动开发:
linux·运维·驱动开发
片酷1 小时前
【Isaacsim&Isaaclab】安装教程
linux·开发语言·python
Magic@1 小时前
Redis学习[1] ——基本概念和数据类型
linux·开发语言·数据库·c++·redis·学习
大腕先生1 小时前
通用分页超详细介绍(附带源代码解析&页面展示效果)
xml·java·linux·服务器·开发语言·前端·idea
红茶要加冰1 小时前
如何安装ubuntu-24.04-live-server-amd64系统
linux·运维·ubuntu
念恒123062 小时前
进程控制---进程等待
linux·c语言
cen__y2 小时前
Linux05(管道)
linux·运维·服务器·c语言·开发语言·文件流