Introduction
As part of a personal project, I recently needed to ping an Azure Windows 2019 virtual machine (VM) for development purposes. However, by default, ping (ICMP echo) is disabled on Azure VMs. In this article, I will explain how to enable ping (ICMP echo) on an Azure VM.
Network Security Group (NSG)
To enable ping on the Azure VM, you need to add a rule to the Network Security Group (NSG) in the Azure portal. Follow these steps:
Go to the Azure portal and select the VM in question.
Select the “Networking” tab and click on “Network security group”.
Click on “Inbound security rules” and then “Add”.
Set the following rule properties:
Source: Any
Source port ranges: *
Destination: Any
Destination port ranges: *
Protocol: ICMP
Action: Allow
Priority: 100 (or any number lower than the default rule)
Name: ICMP
Click “Add” to create the rule.
Enable Ping on the Server
The below images show this.
Once you’ve added the NSG rule, you need to enable ping on the Windows 2019 VM.
RDP onto the VM
after you have RDped onto the server in question, Open the Command Prompt as an administrator. and enter either one of the following commands.
1 2 3 4 5 6 7 |
# For IPv4 netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol="icmpv4:8,any" dir=in action=allow #For IPv6 netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol="icmpv6:8,any" dir=in action=allow |