Skip to content

Instantly share code, notes, and snippets.

@karthiks
Created August 31, 2022 15:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save karthiks/1cff3fff56384f873a614fd59905e075 to your computer and use it in GitHub Desktop.
Save karthiks/1cff3fff56384f873a614fd59905e075 to your computer and use it in GitHub Desktop.
Windows 11 Firewall setup for communication with Expo Dev Server in WSL2
# To get Env Variables available in Powershell
Get-ChildItem -Path Env:\
# To get host IP. See value for IPv4Address
Get-NetIPConfiguration
# Show Current Firewall Settings
netsh interface portproxy show v4tov4
# Reset/Clear All Firewall Settings
netsh interface portproxy reset
# Our Firewall Setting in Action
netsh interface portproxy add v4tov4 listenport=19000 listenaddress=0.0.0.0 connectport=19000 connectaddress=$($(wsl hostname -I).Trim());
@borgogelli
Copy link

Where in the script I should insert the host IP ?

@karthiks
Copy link
Author

@borgogelli The code snippet $(wsl hostname -I).Trim() in line 14 will get it for you. The earlier lines for for clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment