Ping command is one of the built-in network diagnostic commands that you have inside your OS (Windows, Linux, macOS, FreeBSD, etc.). Ping is used for checking the connectivity between your device and the target that cloud be a hostname like google.com or IP address like 192.168.2.1.
Ping, by default, will send 4, 32-byte packets to the target using the ICMP (Internet control message protocol).
Default result of a Ping command
Let’s see one example, so we can see what information does the ping command provides. For this purpose, we will use Windows 10 computer and the Command Prompt. You can use the ping command through the Command Prompt or the PowerShell. It is a matter of preference.
So, type the following command:
Pinging google.com [220.127.116.11] with 32 bytes of data:
Reply from 18.104.22.168: bytes=32 time=26ms TTL=113
Reply from 22.214.171.124: bytes=32 time=31ms TTL=113
Reply from 126.96.36.199: bytes=32 time=32ms TTL=113
Reply from 188.8.131.52: bytes=32 time=24ms TTL=113
Ping statistics for 184.108.40.206:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 24ms, Maximum = 32ms, Average = 28ms
- What we see first is the question part: the target (google.com and its IP address 220.127.116.11) and the packet size(32 bytes).
- The second part is the response: each ICMP ping and how much time it took it. In this case, all 4 packets arrived successfully.
- The third part is statistics: packets send and receive, a calculation of packet loss, and an approximation of round trip time in milliseconds.
Ping command options for more precise probes
You can use additional parameters to change the default ping command and show you a better answer to what you want to know about a target.
Again we will show you how to use additional options for ping on Windows 10 device.
So open the Command Prompt or PowerShell so you can write or paste the command there.
To see the full list of options, use the command:
*In case you are using Linux or macOS, type the command “ping -h” in the Terminal for a list of the available options.
You will also see the Windows Ping syntax:
[-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] [-R] [-S srcaddr] [-c compartment] [-p] [-4] [-6] target_name
Examples of Ping commands
ping -t google.com
This command will create a constant connection with the target. Your computer will continue sending ping commands without stopping. It is great to see that you are still connected to a particular host. If you want to stop it, you will need to press “Ctrl + C”.
Resolve to hostname:
ping -a 18.104.22.168
Use an IP address as a target and resolve to a host.
Send more or fewer pings:
ping -n 8 google.com
You can set the number of packets you want, in our case 8.
Stop packet fragmentation:
ping -f google.com
This won’t allow IPv4 packet fragmentation.
Change the TTL value:
ping -i 13 google.com
The TTL here is the number of hops that the ICMP pings can do. By default, the number is quite high – 113. You can start with a small number and see how many hops are there until the target. The lowest number that still receives answers is the number of hops to the target.
Ping IPv6 address:
Ping -6 google.com
With this command, you can ping and see the IPv6 address of the target.
Ping is the easiest way to check the connectivity between your computer and a target. It is present on almost any OS, so you don’t need to install it additionally. It is useful and fast, and that is why it is still present today.