# This file was automatically generated by WSL. To stopautomatic generation of this file, add the following entry to /etc/wsl.conf:# [network]# generateResolvConf = falsenameserver 172.19.80.1 可以看到 DNS 服务器是172.19.80.1,通过环境变量ALL_PROXY配置代理: exportALL_PROXY="http://172.19.80.1...
export http_proxy="http://${hostip}:${http_hostport}" export ALL_PROXY="socks5://${hostip}:${socks_hostport}" export all_proxy="socks5://${hostip}:${socks_hostport}" ' alias unproxy=' unset ALL_PROXY unset https_proxy unset http_proxy unset all_proxy ' alias echoproxy=' ec...
/bin/bashhost_ip=$(cat /etc/resolv.conf|grep"nameserver"|cut -f2-d" ")exportALL_PROXY="http://$host_ip:7890" 脚本通过cat /etc/resolv.conf来获取 DNS 服务器,也就是 Windows 的 IP,再将其中的 IP 部分截取出来,加上代理客户端的端口(我的是 7890,可以根据自己实际情况修改),使用 export 写入...
要找到 Windows 的 IP 地址,可以利用 cat /etc/resolv.conf 命令在 Ubuntu 子系统中查看 DNS 服务器 IP。以 172.19.80.1 为例,通过设置环境变量 ALL_PROXY=:7890,即可完成 WSL2 中的代理配置。别忘了在 Windows 代理客户端上启用对本地局域网的请求权限。为了简化这一过程,可以编写一个 ba...
exportALL_PROXY="http://127.0.0.1:8000" 但是WSL2 基于 Hyper-V 运行,导致 Linux 子系统和 Windows 在网络上是两台各自独立的机器,从 Linux 子系统访问 Windows 首先需要找到 Windows 的 IP。 02 — 配置WSL2 访问 Windows 上的代理 有两个关键步骤: ...
export https_proxy=$ALL_PROXY 1. 2. 3. 4. 5. 6. git也可以设置为使用代理 : git config --global proxy.https socks5://$windows_host:10808 1. 如果想要这些环境变量和设置每次启动终端都生效, 可以在~/.bashrc文件最下方添加上述内容 :
autoProxy=true Expected Behavior WSL to configure http and https proxy variables as stated here:WSL Troubleshoot When enabled, the following apply to proxy settings on your Linux distributions: The Linux environment variable, HTTP_PROXY, is set to the one or more HTTP proxies found installed in...
export ALL_PROXY="http://172.19.80.1:7890" 1. 7890 是 Windows 上运行的代理客户端的端口,记得要在 Windows 代理客户端上配置允许本地局域网请求。 通过curl cip.cc可以查看自己的IP地址 PS:测试还是不能走代理,防火墙新建相关规则也不行 可能的防火墙配置 ...
dnsProxybooleantrueOnly applicable to networkingMode = NAT. Boolean to inform WSL to configure the DNS Server in Linux to the NAT on the host. Setting to false will mirror DNS servers from Windows to Linux. networkingMode**stringNATIf the value ismirroredthen this turns on mirrored networking ...
一、安装WSL2下的Ubuntu20.04 1)打开windows WSL服务 # 以管理员身份运行 PowerShell dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /no