In this guide we will learn about using ping command on multiple operating systems ping is similar to the traceroute command and is useful for checking networking connections and diagnosing issues.
Ping or Packet Internet Groper is a simple network tool mainly used to diagnose connectivity issues between two points in a network. Ping works by sending special packets (Internet Control Message) to the specified destination which can be an IP address, hostname, or domain.
Once it has sent those packets it waits for response from the destination and calculates the response time which is usually measured in milliseconds or ms. The faster a response time, the lower the number and vice versa with faster (lower latency) responses being preferred.
1. Start by opening a command prompt window by pressing the Windows + R
and enter cmd
after press enter an the command prompt window will appear.
2. Now, type the following command in replacing the IP shown with what you want to ping (hostname, IP, domain).
ping 192.168.1.1
3. Finally, as an example we this is the output from that command to google.com showing a successful test.
C:\Users\user>ping google.com
Pinging google.com [216.58.212.238] with 32 bytes of data:
Reply from 216.58.212.238: bytes=32 time=16ms TTL=115
Reply from 216.58.212.238: bytes=32 time=15ms TTL=115
Reply from 216.58.212.238: bytes=32 time=13ms TTL=115
Reply from 216.58.212.238: bytes=32 time=16ms TTL=115
Ping statistics for 216.58.212.238:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 13ms, Maximum = 16ms, Average = 15ms
In addition to basic usage, ping also supports various parameters that allow for more specific testing. These are added as flags after the ping command and before the destination. For example, if you want to limit the number of packets sent, you can use the -c flag followed by the desired number.
Here are some of the most commonly used flags. Keep in mind that some of these may require administrator privileges.
Parameter | Description | Example |
---|---|---|
-c <count> | Specifies the number of packets to send. | ping -c 5 google.com |
-i <interval> | Sets the time interval (in seconds) between sending each packet. | ping -i 2 google.com |
-s <size> | Sets the size of the packet (in bytes). | ping -s 100 google.com |
-W <timeout> | Sets the time (in seconds) to wait for a response before timing out. | ping -W 1 google.com |
-t <TTL> | Sets the maximum number of hops (TTL) a packet can traverse. | ping -t 30 google.com |
-4 | Forces the use of IPv4. | ping -4 google.com |
-6 | Forces the use of IPv6. | ping -6 google.com |
-a | Plays a sound (beep) for each successful reply. | ping -a google.com |