Allow Wsl2 Access Network

If your WSL2 can't access internet network, you can use following powershell scripts to resolve this issue:

#Requires -RunAsAdministrator

Set-NetFirewallProfile -Profile Private -DisabledInterfaceAliases "vEthernet (WSL)"
Set-NetFirewallProfile -Profile Public -DisabledInterfaceAliases "vEthernet (WSL)"
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -InterfaceAlias "vEthernet (WSL)"  -Action Allow

allow wsl2 access network.ps1


Tags

  1. #WSL
  2. #powershell