How to Use the Ping Command to Test Your Network
The ping command sends packets of data to a specific IP address on a network, and then lets you know how long it took to transmit that data and get a response. It’s a handy tool that you can use to quickly test various points of your network. Here’s how to use it.
How Does Ping Work?
Ping comes from a term used in sonar technology that sends out pulses of sound, and then listens for the echo to return. On a computer network, a ping tool is built into most operating systems that works in much the same way. You issue the ping command along with a specific URL or IP address. Your computer sends several packets of information out to that device, and then waits for a response. When it gets the response, the ping tool shows you how long each packet took to make the round trip—or tells you there was no reply.
It sounds simple, and it is. But you can use it to good effect. You can test whether your computer can reach another device—like your router—on your local network, or whether it can reach a device on the Internet. This can help you determine if a network problem is somewhere on your local network, or somewhere beyond. The time it takes packets to return to you can help you identify a slow connection, or if you’re experiencing packet loss.
And it pretty much doesn’t matter what operating system you’re using. Pull up a terminal or Command Prompt window, and you can use ping on macOS, Linux, or any version of Windows.
How to Use Ping
We’re going to use the Windows Command Prompt in our example here. But you can also use the ping command in Windows PowerShell, or in the Terminal app on macOS or any Linux distro. Once you get to using the actual command, it works the same everywhere.
In Windows, hit Windows+R. In the Run window, type “cmd” into the search box, and then hit Enter.
At the prompt, type “ping” along with the URL or IP address you want to ping, and then hit Enter. In the image below, we’re pinging www.howtogeek.com and getting a normal response.
That response shows the URL you’re pinging, the IP address associated with that URL, and the size of the packets being sent on the first line. The next four lines show the replies from each individual packet, including the time (in milliseconds) it took for the response and the time-to-live (TTL) of the packet, which is the amount of time that must pass before the packet is discarded.
At the bottom, you’ll see a summary that shows how many packets were sent and received, as well as the minimum, maximum, and average response time.
And in the next image, we’re pinging the router on our local network using its IP address. We’re also getting a normal response from it.
When the ping tool does not get a response from whatever devices you’re pinging, it lets you know that, too.
And that’s how to use ping at its most basic. Of course, like most commands, there are some advanced switches you can use to make it behave a bit differently. For example, you can have it keep pinging a destination until you stop the command, specify the number of times you want it to ping, set how often it should ping, and more. But unless you’re doing some very specific types of troubleshooting, you won’t need to worry much about those advanced switches.
If you’re curious about them, though, just type “ping /?” at the Command Prompt to see a list.
So, What Can You Do With Ping?
Now that you know how to use the command, here are some interesting things you can do with it:
- Ping a URL (like www.howtogeek.com) or IP address to see if you can reach an internet destination. If you get a successful response, you know that all the networking devices between you and that destination are working, including the network adapter in your computer, your router, and whatever devices exist on the internet between your router and the destination. And if you’re interested in exploring those routes further, you can use another networking tool named tracertto do just that.
- Ping a URL to resolve its IP address. If you want know the IP address for a particular URL, you can ping the URL. The ping tool shows you right at the top the IP address it’s working with.
- Ping your router to see if you can reach it. If you can’t successfully ping an internet location, you can then try pinging your router. A successful response lets you know that your local network is working okay, and that the problem reaching the internet location is somewhere out of your control.
- Ping your loopback address (127.0.0.1). If you can’t successfully ping your router, but your router appears to be turned on and working, you can try pinging what’s known as a loopback address. That address is always 127.0.0.1, and pinging it successfully lets you know that the network adapter on your computer (and the networking software in your OS) is working properly.
Note: You may not get a ping response from other computers on your local network because the built-in firewalls on those devices prevent them from responding to ping requests. If you want to be able to ping those devices, you’ll need to turn off that setting to allow pings through the firewall.
The list above uses a kind of outside-in approach, where you ping the furthest destination first, and then work your way in to the more local devices. Some people like to work inside-out by pinging the loopback address first, then their router (or another local device), and then an internet address.
And of course, what we’re talking about in this article is mostly about using ping to perform troubleshooting on a home or small business network. On larger networks, there’s a lot more complexity to worry about. Plus, if you’re tasked with troubleshooting larger networks, you probably already know how to use ping and many other networking tools.
No comments:
Post a Comment