When I try to run:
I get the following error:
ping: icmp open socket: Permission denied
sudo doesn't make a difference.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Update: This issue has been fixed since the Windows 10 Creators Update (April 2017). Bash on Windows no longer requires administrator rights to execute the ping command.
Running your "Bash on Windows" shell as administrator should allow the ping command to work. Simply right-click it's shortcut and select the option:
This will only work for the single session opened with these rights.
If other commands also can't connect to the internet (e.g.
wget) then you might also need to look at Internet access not working in Windows Subsystem for Linux.
It didn't work before because as pointed out in @Silveri's answer it requires the ICMP protocol, which wasn't implemented in earlier versions.
As of build 14352, it became enabled for consoles which have administrator privileges.
As of build 14926, it became enabled for consoles which do not have administrator privileges.