I have one Windows 10 computer on a local network.
When I try to ping the Windows 10 machine from some other computer, it fails (Request timed out). From the Windows 10 machine, I can ping other devices with no problems.
I found out that if I go in Control Panel to the "Advanced sharing settings" and I turn on "File and printer sharing," the ping to this machine works normally.
My question is, WHY?
Why doesn't the ping work if "File and printer sharing" is turned off (on the pinged machine)? How is that related to the ping reply? A machine should still reply to a ping even if it does not share file/printer resources, or did I miss something?
5 Answers
Because the File and printer sharing settings include the ability to deny/allow ICMP traffic. You can actually see this by navigating to the following:
- Click the
Startbutton - Search for
Windows Firewall - Select
Advanced Settingson the left - In the left pane select
Inbound Rules - In the right pane look for the rules titled
File and Printer Sharing (Echo Request - ICMPv4-In)
(Source)
You can see an example from my laptop (with File and printer sharing turned on) directly below:
Taking it a step further, if you want to leave File and printer sharing off but still allow "pings," you can enable the appropriate rules shown within the red box in the picture.
9I had issues ping-ing a Windows 10 VM, even if I turned on the file and printer sharing rule.
So I added the following:
netsh advfirewall firewall add rule name="ping" protocol=ICMPV4 dir=in action=allowWarning: this command will apply the rule to the Private, Public, and Domain network profiles.
1"File and Printer Sharing" are a group of firewall rules, some of which also enable answering to the incoming ICMP echo requests sent by ping.
However, to enable ping only, you could also enable another pre-configured group of rules named "Core Networking Diagnostics".
These can all be enabled on the command-line, using netsh. The commands are quite cumbersome, but can be easily copy/pasted to re-use on other machines.
So, to enable ping only, enable the "Core Networking Diagnostics" group:
netsh advfirewall firewall set rule group="Core Networking Diagnostics" new enable=yesTo enable "File and Printer Sharing", which will also enable ping:
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yesAnd to list all pre-configured inbound rules into a "firewall.txt" file in your user directory :
netsh advfirewall firewall show rule name=all dir=in > $HOME\firewall.txt Often the issue can be fixed by moving your interface from PUBLIC to PRIVATE.
Windows assigns (or asks you to assign) network interfaces to either the PUBLIC or PRIVATE network profile. The firewall in windows is configured to allow pings from devices connecting via interfaces in the PRIVATE profile, but not from devices connecting via interfaces in the PUBLIC profile.
You can change the firewall configuration, but it may be easier to move your network interface (LAN, WIFI, etc) from PUBLIC to PRIVATE. This should do the trick.
As an example, for a WIFI interface, click on the wifi icon in the task bar and select the WIFI and properties. Then change the network profile from PUBLIC to PRIVATE.
Windows uses firewall presets, depending on your network type: Public, Private or Domain. Default is Public. In the Public preset, the firewall is set "tighter"; It blocks more, e.g. ping requests. If you turn on File and printer sharing, Windows will change your network type (= firewall preset) to Private. The firewall will be more open, allowing ping requests.
1