How to Use Ping for Troubleshooting
Originally published on February 19, 2018 by Paessler Editorial Team
Last updated on August 31, 2021 • 7 minute read
Ping is a simple tool. It sends out an echo request and waits for a reply. That’s it. But, in that simplicity there is much potential for troubleshooting network issues and finding problems.
i Ping is a command-line utility, available on virtually any operating system with network connectivity, that acts as a test to see if a networked device is reachable. The ping command sends ICMP echo request packets over the network to a specific device. A successful ping results in a response from the computer that was pinged back to the originating computer. Read more ...
Ping The Host
The first step in any connectivity troubleshooting with ping is to simply try and ping the remote host. Remember, not all devices are configured to respond to a ping request, so be sure that what you are trying to ping can even respond. If your ping is returned, then the network is working, and any issue you are having lies somewhere else.
To use ping, just type ping and then the host you are trying to reach.
For example, if you are having trouble connecting to a website, you could try and ping the URL of that website (see example below).
Those four replies show that the network and internet connection is good and that the server is reachable. In this case, maybe the problem is with the webserver configuration instead.
Ping By IP Address
Ping actually sends requests to an IP address. Which brings us to another troubleshooting step. If you can ping a host by its IP address, but not by the name, then the problem is with name resolution. In the example above, if I can ping the IP, but cannot ping the URL, then my problem is with resolving the name, perhaps a misconfigured DNS server. You can for example ping 18.104.22.168.
What Else Ping Tells Us
In the above example, there were four pings sent and replies received. Also listed is the time that the pings took, in this case a minimum of 13 milliseconds (ms), and a maximum of 23 ms . A wide variation might suggest that there is a connection issue, perhaps network congestion. While there is no “good” time for a ping to take, a time that is significantly higher than usual, or significantly higher than other hosts on the same network could indicate issues as well.
While all four of our pings came back good, missing pings suggest trouble on the network. However, if some pings do come back, then at least the network configuration is functional.
How To Pin Point Network Issues With Ping
Knowing that your network connection isn’t working properly or your internet is down is one thing. Knowing where the problem is, is much better. To get a better idea about where the network issue is, an administrator can ping key parts of the network infrastructure like the router.
The first key point to ping is the gateway. On many computers the default gateway can be determined by examining the IP configuration. If the gateway pings, that means the local portion of the network is functioning and the problem lies beyond.
If the gateway does not ping, then either the problem is with the gateway itself, or on the route to the gateway.
To test connectivity to the internet, some administrators ping 22.214.171.124, which is Google’s primary DNS server. It is not only easy to remember, it is very likely to be up and running at any given time.
Finally, pinging the loopback address ensures that the network stack is functioning and properly initialized on the system itself. To ping the loopback address, simply ping 127.0.0.1. If that fails, the network is not running properly on the system.
Another trick for troubleshooting with ping is to set a continuous ping. This can be useful for many situations, including ensuring the remote host stays reachable, or to see when connectivity is lost.
For example, an administrator can set a system to ping a remote host while making adjustments to wiring, or testing network equipment. If the pings stop coming back successful, then the change has broken the previously functioning network. This is particularly useful when installing, replacing, or removing network equipment.
To continuously ping with Windows, use the -t switch.
ping -t URL.
Type CTRL-C to end the pinging, or close the command window.
Ping From Different Global Locations
To get reliable ping data it is necessary to ping from different global locations. Imagine your server is located in Germany - a Ping response from a site in Germany can be way faster than the response time you get if you ping from China.
An easy way to test the response time from different locations all over the globe is our brand-new Ping Speed Test. We drop several ping commands from every continent and give you insight in minimum, maximum and average response time - plus more details of what a good ping speed is.
And now it's getting exciting. Want to know what the current ping times are for your (or any) website? Then take a look at our brand new ping test tool and see how ping times can be improved in your individual case.