I cannot ping any website when I am using WSL for windows 10. I'm running Ubuntu 18.04 in WSL.

--- google.com ping statistics ---
14 packets transmitted, 0 received, 100% packet loss, time 38567ms

is the result when I try ping google.com I am using windows 10 with IPv4, disabled IPv6. I can ping google.com normally without wsl on my regular command prompt

I'm running Avast internet security and when I ping google from inside the ubuntu/WSL instance this is what I see.

1: enter image description here

What do I need to do to enable pinging in WSL


First some background. One should need Windows 10 Build 17627 or higher to support Firewall with WSL connections. Here is the section from WSL release notes:

Build 17627 (Skip Ahead)


  • Windows firewall support for WSL processes. [GH 1852]
    • For example, to allow the WSL python process to listen on any port, use the elevated Windows cmd: netsh.exe advfirewall firewall add rule name=wsl_python dir=in action=allow program="C:\Users\<UserName>\AppData\Local\Packages\canonicalgrouplimited.ubuntuonwindows_79rhkp1fndgsc\localstate\rootfs\usr\bin\python2.7" enable=yes
    • For additional details on how to add firewall rules, see link

Next step, find absolute path of the Linux executable that wants Internet connection. The full path can be divided into three parts:

  1. C:\Users\UserName\AppData\Local\Packages -- Path where Universal Windows Platform apps store user specific files, temporary files etc.
  2. CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs -- Path where Ubuntu 18.04 Appx package store Ubuntu usersapce files i.e. /bin, /etc, /usr and others.
  3. \bin\ping -- Linux ping binary.

Hence the whole path is:


You can use the following PowerShell script to get that path. Just enter ubuntu when it asks to enter Distribution name.

$DistroName=Read-Host "Enter Distribution Name"
$pacakgeName = (Get-AppxPackage *$DistroName*).PackageFamilyName
$appData = [System.Environment]::ExpandEnvironmentVariables("%LocalAppData%")
$InstallDir = $appData + "\Packages\" + $pacakgeName + "\LocalState\rootfs"
echo $InstallDir
Invoke-Item $InstallDir
Read-Host -Prompt "Press any key to continue..."

Final step, add the firewall rule. For Windows Firewall, run this command as administrator to add Outbound firewall rule.

netsh.exe advfirewall firewall add rule name=wsl_ping dir=out action=allow program=<path_to_ping> enable=yes

For Avast Firewall, follow this instruction from Avast Support. Open Settings > General > Exclusion and add the path from previous step.

Canonical answers:

  • I ran command prompt as administer and ran the netsh.exe command and the result was ok. Then i went into my avast internet security and added the ping path to allow all but I am still getting 100% packet loss when I try to ping google.com on wsl ubuntu – user3369850 Sep 17 '18 at 22:34
  • @user3369850 here is a GitHub discussion you can follow: github.com/Microsoft/WSL/issues/475 – Biswapriyo Sep 19 '18 at 3:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.