Created
August 31, 2022 15:57
-
-
Save karthiks/1cff3fff56384f873a614fd59905e075 to your computer and use it in GitHub Desktop.
Windows 11 Firewall setup for communication with Expo Dev Server in WSL2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 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
Where in the script I should insert the host IP ?