Source: Access WSL localhost from LAN
- Get first IP from
wsl hostname -I
- Call
New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Inbound -LocalPort <your-port> -Action Allow -Protocol TCP";
on PowerShell - Forward the port with
netsh interface portproxy add v4tov4 listenport=<your-port> listenaddress=0.0.0.0 connectport=<your-port> connectaddress=<your-ip-from-step-one>
Detailed explanation with samples on Managing firewall rules on Windows through PowerShell and Managing port proxies on Windows through netsh