The ping command on Windows is the network diagnostic tool to check the availability of the network connection. It is the method of sending the packets between the hosts to check the strength of the connection by getting the response back.

The ping command employs the ICMP(Internet Control Message) protocol to transfer packets across the network by giving the destination address. The ICMP provides Query, Response, and Error messages to ensure the availability/accessibility of the network.

This guide will explain the process of using the ping command on Windows.

How to Use Ping Command on Windows

To use the ping command on Windows, simply launch the Command Prompt(CMD) on your Windows and execute the ping command with the “/?” flag:

ping /?

On successful execution, the above command displays all the flags that can be used with the ping command on Windows. These flags are used to get the specific details from the network interaction or ping for a certain amount of time:

Ping a Server

You can type the server’s name like “google.com” or “microsoft.com” with the ping command to get the server’s response. To do so, simply execute the stated command with the below-mentioned syntax:

ping google.com

Running the above command displays the response from the Google server with the bytes, time, and TTL. The details retrieved after the execution of the stated command are listed below:

  • It displays the reply from the server’s IP address as highlighted in the following screenshot with the number of bytes.
  • The bytes show the data sent by the server in each ICMP packet which is generally in 32/64.
  • The time shows the response time from the server to get the data. It shows the time taken by the server to get the query from the source to give the response back to the source.
  • TTL or Time To Live suggests the travel routes of the packet before getting to the dead state. It is the lifetime of the packet with the path of the packet taken through the routers.
  • The Ping statistics contain general information on the success rate as in what percentage of packets are successfully sent and received.
  • The Approximate round trip suggests the maximum, minimum, and average time for the packets:

Ping an IP Address

You can also type the IP address of the server instead of the server’s name to ping it as mentioned in the following code block:

ping 8.8.8.8

The 8.8.8.8 is the Google DNS server IP address, so the above command also pings the Google server:

Ping the localhost

Replace the IP address with the localhost to execute the ping command as written below. This command gets the response from the localhost which doesn’t let the packets pass through any physical network interface. However, it simply lets the packets pass through the virtual network called the loopback interface:

ping localhost

Execute the above command to get the response from the “localhost” using the loopback IP address(::1) as displayed in the following screenshot:

Ping Until Terminated Externally

Here, we use the “-t” flag with the ping command to get the response packets from the Google server constantly. To stop getting the response packets from the server, you need to terminate the command by pressing “Ctrl + c” from the keyboard:

ping google.com -t

Executing the above command retrieves a stream of packets received from the Google server which shows the constant connection:

Ping With a Beep

We can also use /a flag with the ping command to get the audible beep with each packet received by executing the following command:

ping /a google.com

Ping With a Specified Number of Echos and Packet Size

The following command contains 2 additional flags: “/n” and “/l” with the ping command to the Google server. The “/n” flag suggests the number of packets which is determined by the number after the flag. The “/l” flag suggests the size of the data in the packet using the number or size following the flag:

ping /n 10 /l 500 google.com

Executing the above command sends 10 packets of size 500 bytes as mentioned in the following screenshot:

Note: There are multiple other flags like -r, -j, -c, and others to control the sending and receiving of packets to and from the server. This enables the user to control the communication with factors like the number of packets, response time, data in each packet, etc. These factors bring control to the user as he can observe the performance and strength of the network.

Conclusion

To use/execute the ping command on Windows, simply open the CMD terminal and type the ping command with its destination server. The ping command sends the ICMP packets to the server and gets the response back from the server as well. The user can also write different flags with the ping command like -t, /a, /n, /l, etc. to check the performance of the network.