Windows syntax
Usage: ping [-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] [-4] [-6 target_name
Options:
-t | Pings the specified host until stopped. To see statistics and continue – Type Control-Break; To stop – press Ctrl + C. |
-a | Resolve addresses to hostnames. |
-n | count Number of echo requests to send. |
-l size | Send buffer size. |
-f | Set Don’t Fragment flag in packet (IPv4-only). |
-i | TTL Time To Live. |
-v | TOS Type Of Service (IPv4-only. This setting has been deprecated and has no effect on the type of service field in the IP Header). |
-r count | Record route for count hops (IPv4-only). |
-s count | Timestamp for count hops (IPv4-only). |
-j host-list | Loose source route along host-list (IPv4-only). |
-k host-list | Strict source route along host-list (IPv4-only). |
-w timeout | Timeout in milliseconds to wait for each reply. |
-R | Use routing header to test reverse route also (IPv6-only). Per RFC 5095 the use of this routing header has been deprecated. Some systems may drop echo requests if this header is used. |
-S srcaddr | Source address to use. |
-4 | Force using IPv4. |
-6 | Force using IPv6. |
Windows XP and lower syntax
ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list
Options:
-t | Pings the specified host until stopped. To see statistics and continue – Type Control-Break; To stop – press Ctrl + C. |
-a | Resolve addresses to hostnames. |
-n count | Number of echo requests to send. |
-l size | Send buffer size. |
-f | Set Don’t Fragment flag in packet. |
-i TTL | Time To Live. |
-v TOS | Type Of Service. |
-r count | Record route for count hops. |
-s count | Timestamp for count hops. |
-j host-list | Loose source route along host-list. |
-k host-list | Strict source route along host-list. |
-w timeout | Timeout in milliseconds to wait for each reply. |
Examples
ping localhost
Pings the localhost, which helps determine if the computer can send information out and receive the information back from itself.
Note: The above command does not send information over network, but can indicate if the card can respond .
ping computerhope.com
Ping supports the ability to ping an Internet address. In the above example, we pinged “computerhope.com” and as can be seen, received four responses back. If we couldn’t reach the server or the server was blocking our request we would have lost all four packets.
ping 45.79.151.23
Allows you to ping another computer where <45.79.151.23> can be the IP address of the computer you want to ping. If you do not get a reply or get lost packets you have a problem with your network, which can be a cable issues, network card issues, drivers, router, switch, or other network problem.
Related questions
Is there a continuous ping options?
ping <address> -t
Use the -t option to ping any address until you cancel it by pressing Ctrl + C.
When I ping the IP address doesn’t look right.
In newer versions of the ping command and computers running on IPv6 you may get an IP address that looks something like [fe80::51c1:5214:a18e:8dec%12] instead of [192.168.1.7] to get the IPv4 IP address use the below command.
ping <hostname> -4
Show the timestamp
you may want to pinpoint the network connectivity issue time. you can do it from the powershell:
Ping.exe -t <address> | ForEach {"{0} - {1}" -f (Get-Date),$_}
Store the output in a text file
From the powershell:
Ping.exe -t 10.130.104.8 | ForEach {“{0} – {1}” -f (Get-Date),$_} >> c:\tmp\ping.txt
To show the result on screen as well:
Ping.exe -t 10.130.104.8 | ForEach {“{0} – {1}” -f (Get-Date),$_} | tee c:\tmp\ping.txt
Specify the source interface of the Ping command
Ping.exe -S 10.130.108.101 -t 10.130.104.8