Can't ping in Bash on Windows
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.
"The Windows TCP/IP stack requires admin privileges to open RAW sockets for security measures" [source]. See MSDN post. This only applies to low-level network protocols such as ICMP used by ping
.
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. apt-get
, 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.