In Windows Server 2016, 2019, and 2022, ICMP or Ping is disabled by default, making the system more secure, but sometimes this brings certain difficulties in monitoring.
Since the ping command indicates/shows that the remote computer is connected to the network, it is a useful command for system administrators.
If you need to enable ICMP packets or ping for your own purposes or for monitoring, you can use the instructions below.
It can be enabled manually without using group policies.
If ICMP packets are not enabled on your computer, you will receive a timeout message.
How to Enable Ping in Windows Firewall
To enable ping in the firewall, follow these steps:
Open the firewall by pressing Win+R and typing the command firewall.cpl.
In the window that opens, click Advanced Settings on the right panel.
Select Inbound Rules on the left panel and on the right panel New Rule.
Select File and Printer Sharing in the Predefined section. And click Next.
Select the following two rules:
- File and Printer Sharing (Echo Request – ICMPv6-In)
- File and Printer Sharing (Echo Request – ICMPv4-In)
And click Next.
Select Allow the connection. Click Finish.
How to Enable ICMP (Ping) from Command Line or PowerShell
To do this, open the command line by pressing Win+R and typing the command cmd.
Allow ping IPv4 from the command line:
netsh advfirewall firewall add rule name="ICMP Allow Ping V4" protocol="icmpv4:8,any" dir=in action=allow
Allow ping IPv4 using PowerShell:
New-NetFirewallRule -DisplayName "ICMP Allow Ping V4" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -RemoteAddress <localsubnet> -Action Allow
If after testing and settings you need to disable ICMP packets, you can also use the command line for this.
Block ping IPv4 from the command line:
netsh advfirewall firewall add rule name="ICMP Allow Ping V4" protocol="icmpv4:8,any" dir=in action=block
Block ping IPv4 using PowerShell:
New-NetFirewallRule -DisplayName "ICMP Allow Ping V4" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -RemoteAddress <localsubnet> -Action Block
We also suggest you other useful articles:
- How to connect to the server via FTP, SFTP and SCP
- How to Install and Configure IIS FTP Server on Windows Server 2019
- How to connect to a Docker container via sFTP