Linux – Can’t ping in Bash on Windows

bashwindows 10windows-10-v1607windows-subsystem-for-linux

When I try to run:

ping www.google.com

I get the following error:

ping: icmp open socket: Permission denied

Running with sudo doesn't make a difference.

Best Answer

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:

Select 'run as administrator' for Bash start menu shortcut

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.

Related Question