In this article, I will discuss how to enable ping in AWS EC2 instance. To find the root cause of this issue, you need to know what is PING command is.
What is PING
Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It is available for virtually all operating systems that have networking capability, including most embedded network administration software.
Ping measures the round-trip time for messages sent from the originating host to a destination computer that is echoed back to the source. The name comes from active sonar terminology that sends a pulse of sound and listens for the echo to detect objects underwater.
Ping operates by sending Internet Control Message Protocol (ICMP) echo request packets to the target host and waiting for an ICMP echo reply. The program reports errors, packet loss, and a statistical summary of the results, typically including the minimum, maximum, the mean round-trip times, and standard deviation of the mean.
What could be the problem in AWS EC2
So if you can ping an IP or hostname, that means you can actually reach that server or system. Ping requires the destination host to have the ICMP port open and whitelisted for that IP.
How to Solve the issue
To solve this, you need to login to your AWS and then go to ec2 section.
Next click on the instance to go to the details of that instance. Over there you will see a tab “Security”.
Click the tab “Security” and open the security group settings.
Next, click on the edit Inbound Rule Button to edit the inbound rules.
Add an inbound rule for ICMP
Now save and run the ping command from your terminal again.
This time you will be able to see response from server.