Skip to content

Instantly share code, notes, and snippets.

@axelitus
Last active May 30, 2022 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save axelitus/6e2a056ae61a82162639d187b6b931ec to your computer and use it in GitHub Desktop.
Save axelitus/6e2a056ae61a82162639d187b6b931ec to your computer and use it in GitHub Desktop.
Port exclusions to allow port redirection to WSL2
# Run commands in an elevated prompt
# Stop WinNAT
net stop winnat
# Docker
netsh int ipv4 add excludedportrange protocol=tcp startport=50000 numberofports=50 # Docker - extend range as needed
# Laravel Sail services
netsh int ipv4 add excludedportrange protocol=tcp startport=80 numberofports=1 # Web server
netsh int ipv4 add excludedportrange protocol=tcp startport=3000 numberofports=10 # BrowserSync
netsh int ipv4 add excludedportrange protocol=tcp startport=3306 numberofports=1 # MySql
netsh int ipv4 add excludedportrange protocol=tcp startport=6379 numberofports=1 # Redis
netsh int ipv4 add excludedportrange protocol=tcp startport=1025 numberofports=1 # Mailhog
netsh int ipv4 add excludedportrange protocol=tcp startport=8025 numberofports=1 # Mailhog Dashboard
netsh int ipv4 add excludedportrange protocol=tcp startport=8080 numberofports=1 # HotReloading (HMR)
# Spatie's Ray
netsh int ipv4 add excludedportrange protocol=tcp startport=23517 numberofports=1 # Ray - change as needed
# PhpStorm/xDebug
netsh int ipv4 add excludedportrange protocol=tcp startport=9000 numberofports=1 # xDebug 2
netsh int ipv4 add excludedportrange protocol=tcp startport=9003 numberofports=1 # xDebug 3
# Additional useful ports
netsh int ipv4 add excludedportrange protocol=tcp startport=6000 numberofports=1 # X11
# Other ports
netsh int ipv4 add excludedportrange protocol=tcp startport=6379 numberofports=1 #
netsh int ipv4 add excludedportrange protocol=tcp startport=6991 numberofports=1 #
# Start WinNAT
net start winnat
# Show excluded ports
netsh int ipv4 show excludedportrange tcp
# Best to do: restart Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment