Ping: what it is and how to use it

Ping: what it is and how to use it

12.10.2021
Author: HostZealot Team
2 min.
1601

A dedicated or virtual private server, a website or a separate network node, a remote computer or a printer - with all of them sometimes you need to make sure they are functioning and connecting "to the world" properly. To do this is easy: you need the ping command at the command line. What is it and how else can it be used? Read about it in our article!

What is ping?

To be precise, the ping command is a special utility written by Mike Muuss in 1983. It is designed to evaluate connections in TCP/IP-based networks and works with so-called echo requests. It's a small data packet that you send to the address you're interested in and wait for the answer, the echo, which in turn allows you to make some conclusions about the health of the host. This check, unofficially known as pinging, is very simple and functional and can be used for many tasks:

  • Making sure that there is a connection to the server as such and that the DNS-server settings are correct;
  • To find out what is wrong - the server itself or the whole network is failing;
  • See the data loss in the channel, comparing their number in the sent and received packets;
  • Calculate the connection speed by the amount of forwarded data per unit time;
  • Find out the IP address by the domain (by querying the DNS-server, it is performed before the packets are sent).

How do I use the ping command?

The ping command, as already mentioned, is very easy to use - both on Windows and Unix systems. Although each of these operating systems has its own nuances and should be mentioned separately.

Windows

The procedure for checking the communication with a website, server, remote device, etc. on any "Windows" includes essentially three steps:

  1. Opening a command line. There are two options, both are quite fast to execute. In the first case, click on "Start" and find in its menu item "Command Line" (in Windows 10, for example, it is placed in the "Utilities - Windows"). In the second case, press the combination of Win and R on your keyboard to call the Run application and enter in his line cmd.
  2. Forming a request. The syntax of the ping command at the command line is also simple and straightforward. It includes the ping command itself and the domain name or IP and goes like this: ping site.com or ping 192.168.1.1 (replace site.com and 192.168.1.1 with your parameters). With the basic data you can enter additional keys, but more about them below.
  3. Getting a response. After pressing Enter the whole process will start and you will be able to see it in real-time. After a few seconds (if everything is OK, of course) you will have full statistics. It will show the number and volume of packets transmitted, the time taken (both peak and average), the percentage of losses, etc.

Unix

The working principle of this utility is the same in these operating systems, although there are differences from version to version (e.g. the order of the additional parameters in relation to the main ones). The whole test is performed in the same three steps:

  1. Opening a terminal. The terminal acts as a command line, its functions in Linux and other "builds" are similar. The keyboard shortcuts Ctrl+Alt+T or Ctrl+Alt+F1 (if your OS has a graphical interface) are used to open it.
  2. Creating and receiving ping requests. The ping command is written in the same way as in Windows: with a domain or IP and subkeys. This is also true for the response you get from the server, site or device and the detailed information it contains about the network operation.
  3. Stopping a command. An important difference to Unix: in Windows pinging by default only sends 4 packets, here it is actually done for as long as it takes. Therefore after getting enough information you have to press Ctrl+C to stop the next pings.

What are additional keys?

The ping command in the Windows command line or in the Unix terminal can be modified for a specific task with the help of those keys. They are additional characters to adjust the parameters you want, and you enter them between ping and the domain/IP name by themselves or together with the desired value. There are quite a few of them, therefore we will give only a few popular ones for "Windows":

  • -t: start Windows infinite packet sending mode until the user stops sending the packets;
  • -n: change the number of packets to be sent, the key is appended by the right number (there are only 4 in the "base");
  • -l: correction of the packet size, also with the required parameter (from the standard 32 bytes to 65500);
  • -w: correction of the echo-response waiting time, it is paired with the required number (standard is 4000 - in milliseconds, i.e. 4 seconds);
  • -f: blocking fragmentation of requests by routers, which allows avoiding problems and losses in some situations;
  • /?: call for help in case you have problems with the ping command (this key in the syntax is put in place of the domain name or IP).

It is important to note that you can specify several additional keys in one line when forming queries. This may look like this: ping -l 1024 -w 10000 site.com (here you create a ping with packets of 1024 bytes and an interval of 10 seconds).

Why contact HostZealot?

We are sure that with a trusted provider such as ours, you will rarely have to check if there is a problem with your website or server. We guarantee: Our equipment is stable and fault-tolerant. This ensures low latency for our rented dedicated servers or VPS!

Related Articles