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

即为配置成功

相关推荐
---学无止境---1 天前
Linux中进程创建和缓存对象初始化fork_init、proc_caches_init和buffer_init
linux
qq_183802871 天前
Linux内核idr数据结构使用
linux·运维·服务器
噜啦噜啦嘞好1 天前
Linux:库制作与原理
linux·运维·服务器
---学无止境---1 天前
Linux中将EFI从物理模式切换到虚拟模式efi_enter_virtual_mode函数的实现
linux
刘某的Cloud1 天前
磁盘-IO
linux·运维·系统·磁盘io
我狸才不是赔钱货1 天前
容器:软件世界的标准集装箱
linux·运维·c++·docker·容器
云知谷1 天前
【嵌入式基本功】单片机嵌入式学习路线
linux·c语言·c++·单片机·嵌入式硬件
挺6的还1 天前
Boost搜索引擎
linux
天赐学c语言1 天前
Linux进程信号(上)
linux·可重入函数·进程信号
ajassi20001 天前
开源 Linux 服务器与中间件(四)服务器--Tomcat
linux·服务器·开源