Post

Setting Up WSL2 Proxy for Windows 11

ref

WSL2 has made an important change in the network configuration since version 2.0.0.

We can enable proxy in wsl2 for win11 easily by following the steps below.

Paste the following setting to the %UserProfile%/.wslconfig.

1
2
[wsl2]
networkingMode=mirrored

This may cause issues if you want to use localhost ports in WSL2. You would have to use proxy in that case.

Set up proxy manually

  1. Get the virtual ip of host machine using windows powershell: ipconfig.
  2. Set up the proxy in ~/.bashrc: export http_proxy="http://[IP]:[PORT]"
This post is licensed under CC BY 4.0 by the author.