What is the ping command? What is ping in apps and games? How to use ping, in Windows?

Even though you are not a networking expert, you may have encountered the term PING, when using computers, networking devices like wireless routers, online apps or when playing games on the internet. If you want to know what the ping is when it comes to computers, how the ping command works, how to understand the data it displays, and how to use it in Windows, read this tutorial:

What is ping?

Ping is a command line tool, available in many operating systems, that you can use to test whether your computer or device can reach a destination computer through the network and/or the internet.

What is ping in networking tests (SpeedTest) or games?

When you see the ping reported in all kinds of apps, in networking tests like SpeedTest, or in online games, it refers to the time it takes for your PC to get a response to a ping command. This time is reported in milliseconds (ms), and it is an indicator of the speed of the reaction time of your internet connection or your network connection. The lower the ping, the better the reaction time.

Why is ping useful?

The ping command is useful mostly for troubleshooting the accessibility of devices on the network and the internet. This command uses a series of Echo messages (using the Internet Control Message Protocol) to determine things like:

  • Whether the target of the ping command is active or inactive.
  • How much time it takes to communicate with the target device, to send and receive an Echo request and a reply.
  • How many packets are lost when communicating with the target device.

To better understand things, take a look at the screenshot below, where we ran a ping command, in Windows: ping www.microsoft.com.

From this command, we learned the following:

  • That the www.microsoft.com website is available and reachable from our Windows PC because we received a reply.
  • The IPv6 address of the microsoft.com website. It is the weird address that is displayed after the text “Reply from.”
  • That there was no data loss in our connection to the microsoft.com website.
  • The time it took, in milliseconds, for microsoft.com to reply to our ping command: for each of the four echo requests individually, the minimum, the maximum and the average time it took to respond to our ping command.

As you can see, the ping utility sends four echo requests by default, and it shares statistics and data based on the replies it should get from the target.

Who invented ping?

The ping utility was created by an American named Mike Muuss, in December 1983, while working in Ballistic Research Laboratory at the Aberdeen Proving Ground, in Maryland. The name comes from the sonar technology used in submarines, surface ships, and aircraft, that sends a pulse and listens for the echo to detect underwater objects. He found it a suitable metaphor for how the ping utility works.

In which operating systems and devices is ping available?

You can use the ping tool in Windows, Linux, MAC OS X, Unix, FreeBSD and many other operating systems for desktop computers, servers, and other equipment. Even networking equipment like routers implemented the ping tool for troubleshooting network problems.

How to use ping in Windows?

If you want to use the ping tool in Windows, open the Command Prompt or PowerShell. Then, enter ping followed by the IP address (or the hostname) of the target computer or device. For example, type something like: “ping” or “ping www.bing.com” without the quotation marks.

As documented by Microsoft, here, the ping command in Windows can use lots of parameters:

ping [-t] [-a] [-n <Count>] [-l <Size>] [-f] [-I <TTL>] [-v <TOS>] [-r <Count>] [-s <Count>] [{-j <Hostlist> | -k <Hostlist>}] [-w <timeout>] [-R] [-S <Srcaddr>] [-4] [-6] <TargetName>

To see them for yourself, write ping /? or ping -? and press Enter on your keyboard. Windows lists all the parameters and switches that you can use for the ping tool.

NOTE: You can use / or - before any parameter of the ping command. They are interchangeable and lead to the same result.

Here is an explanation of all the switches for the ping command:

  • /t - ping continues sending Echo request messages to the destination until interrupted manually. To interrupt and display statistics, press CTRL+Break. To interrupt and quit the ping, press CTRL+C.
  • /a - the ping tries to resolve and show the hostname of an IP address that is entered as the target.
  • /n count - use this change the number of Echo request messages from 4 (the default) to something else. You can use any number from 1 to 4294967295.
  • /l size - sets the size (in bytes) of the Echo request message that is sent to the target, from 32 (the default) to something else. You can use any number from 1 to 65527.
  • /f - use this to send Echo request messages with a “Do Not Fragment” flag turned on so that the request is not fragmented by routers, on the way to the destination. This option works for IPv4 addresses only, and it is useful for troubleshooting path Maximum Transmission Unit (PMTU) problems.
  • /i TTL - sets the Time to Live (TTL) value for the Echo request, the maximum of which is 255. TTL limits the lifetime of the data being sent by the ping command. If the TTL value has elapsed and no reply was received, the data is discarded.
  • /v TOS - sets the Type of Service (TOS) used for the Echo request. The default value is 0, and the maximum is 255. This option works only for IPv4 addresses.
  • /r count - sets the number of hops between your PC and the target that you want be recorded and displayed by the ping command. The maximum value for the count is 9. It works only with IPv4 addresses.
  • /s count - reports the time (in Internet Timestamp format) when each Echo request is received and each reply is sent. The maximum value for the count is 4, meaning that only the first four hops can be time stamped. This option works just with IPv4 addresses.
  • /j host-list - uses the Loose Source Route specified in the host list. With this type of routing, successive intermediate destinations can be separated by one or multiple routers. The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses separated by spaces, and they have to be IPv4 addresses.
  • /k host-list - uses the Strict Source Route specified in the host list. With strict routing, the next intermediate destination must be reachable directly (and not separated by a router). The maximum number of addresses or names in the host list is 9. The host list is a series of IPv4 addresses separated by spaces.
  • /w timeout - the timeout value adjusts the amount of time, in milliseconds, that the ping waits for each reply. The default timeout value is 4000 or 4 seconds.
  • /r range - tells the ping command to trace the round trip path, for a number of hops. It works only with IPv6 addresses. The range must be a number between 1 and 9.
  • /s srcaddr - specifies the source address to use when working with IPv6 addresses. The address must be entered after srcaddr.
  • /c compartments - specifies the routing compartment identifier.
  • /p - pings a Hyper-V Network Virtualization provider address.
  • /4 - forces the use of the IPv4 address and it is used in conjunction with hostnames, not IP addresses. For example, write “ping /4 www.microsoft.com” (without the quotation marks), and it returns the IPv4 address of the hostname.
  • /6 - forces the use of the IPv6 address and it is used in conjunction with hostnames, not IP addresses. For example, write “ping /6 www.microsoft.com” and you see the IPv6 address of the hostname.

A few examples of working with the ping command:

To make sure that you better understand how to work with the ping command, we will share a few examples and explain how they are used in real life. If you want to monitor a certain website and its availability, you could use “ping -t domainname” without the quotation marks. The command endlessly pings it and shares the time it takes to reply to each Echo request.

However, if you do this kind of endless monitoring of well-managed hosts, your PC could get banned from accessing. Do not forget to stop it by pressing CTRL+C on your keyboard.

You may want to use a finite number of Echo request messages to send, using “ping -n count hostname” like in the example below:

In the screenshot above you can see that the host was initially available and replying to the ping command, and it then went offline, and all the remaining requests timed out.

If you know the IP address of a host, and you want to know the hostname, you can use “ping -a IP address”. The ping tries to resolve and display the hostname of the target and then returns it, similar to the screenshot below.

Do you use the ping command, and how?

Now you know what ping is, how it works, what it does, and how to use it in Windows. Before closing this tutorial, comment below and share any questions that you might have. Also, we would like to know how you use the ping command.