Set up http/https proxy inside WSL.
https://learn.microsoft.com/en-us/windows/wsl/networking
Port
If the v2ray has the following setting:
1 2
| 本地:[socks:10808] | [http:10809] 局域网:[socks:10810] | [http:10811]
|
Then:
NAT
1 2 3 4 5 6
| WINDOWS_HOST=`cat /etc/resolv.conf|grep nameserver|awk '{print $2}'`
export http_proxy=http://$WINDOWS_HOST:$PROXY_PORT export https_proxy=http://$WINDOWS_HOST:$PROXY_PORT export HTTP_PROXY=http://$WINDOWS_HOST:$PROXY_PORT export HTTPS_PROXY=http://$WINDOWS_HOST:$PROXY_PORT
|
Mirrored
In C:\Users\songz\.wslconfig of Windows host:
1 2 3 4 5 6
| [experimental] autoMemoryReclaim=gradual # gradual | dropcache | disabled networkingMode=mirrored dnsTunneling=true firewall=true autoProxy=true
|
Then in WSL2:
1 2 3 4 5 6
| WINDOWS_HOST=localhost
export http_proxy=http://$WINDOWS_HOST:$PROXY_PORT export https_proxy=http://$WINDOWS_HOST:$PROXY_PORT export HTTP_PROXY=http://$WINDOWS_HOST:$PROXY_PORT export HTTPS_PROXY=http://$WINDOWS_HOST:$PROXY_PORT
|