How to connect wsl to a windows localhost?
I'm trying to let WSL use a localhost proxy(actually its Fiddler) on my windows, but I can't see any connection like that, and downloads usually fail, how do I fix that?
I know that I can connect to Linux localhost from the windows one, but how can I reverse this?
WSL is Ubuntu 18.04
I am not sure if the following will work with applications that are bound to just localhost, but this worked for Fiddler and WSL2:
Set the Fiddler option "Allow remote computers to connect" and restart Fiddler
Grab your WSL network connection info (on my machine, the adapter is called
vEthernet (WSL)
)Use that address, e.g. 172.26.224.1 where you would normally use localhost
You should run the following command in a powershell run as administrator:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
This command comes from this WSL2 ticket. Any firewall rule related to WSL IP address won't be effective because with WSL2 IP changes every time.