How to Use the Ping Command to Troubleshoot Network Issues

by Sydney Butler

The ping command is one of the most helpful network diagnostic tools at your disposal. It’s useful for finding problems both on your local network and on the wider internet. Let’s look at what the ping command does and how to use it.

What Does It Mean to Ping Something?

To “ping” something on a network means that you send an internet packet to a destination computer or other network device, asking for a response. That device then sends a packet back to you. 

Table of Contents

    When the packet comes back (if it makes it back, that is) you can learn all sorts of interesting things about the network between yourself and the destination. 

    Most commonly, we simply want to know how long the reply takes. So when someone mentions the “ping” of (for example) a website, it’s usually expressed in milliseconds, with a lower number being better in general.

    What Is an Internet Packet?

    To better understand ping, you need to know a little about the packet you’re sending to the target computer or network device as a “ping.” 

    Packets are the fundamental units of the modern internet. When you send someone data, like a photo, it gets broken up into tiny pieces. Each packet is marked with a source and destination address and then sent off into the internet. These packets pass through many other computers, such as web servers and internet routers. Packets keep getting passed along until they reach the target system.

    What You Can Use Ping For

    The ping command has two primary uses:

    Even if your ping reaches its destination and you get a reply, the ping response will tell you how long a packet took to return and how many packets have been lost. You can use the ping command to diagnose if the connection is too slow or unreliable.

    What sorts of things can you ping? 

    How to Use Ping on Windows

    Using ping is easy. You run it from the Command Prompt or PowerShell, but we’re using the Command Prompt in this example:

    1. Open the Start Menu, search for the Command Prompt, and select it.
    1. Type Ping and then enter either the IP address of the device or the URL of a site you’d like to ping.

    We’ve used Google.com as an example below.

    Once initiated, ping will send four packets of data.

    A message for any packets that says “request timed out” implies that your computer did not receive a reply from the target. If some packets are lost, some of the routing paths between your computer and the target have an issue.

    Useful Ping Command Modifiers for Windows

    There are quite a few command switches you can use with the ping command. Switches are extra options to customize how the ping command functions. If you want to see a complete list of options, all you have to do is type ping /help at the Command Prompt and press Enter. You’ll see the whole list as well as the syntax and usage.

    Below is a list of a few command switches that are of use to most users:

    How to Use Ping on macOS

    For Mac users, you have to user Terminal. Previous versions of macOS included Network Utility, which was a graphical utility that you could use to run network commands like ping.

    However, the latest versions have deprecated that utility in favor of Terminal. It’s not as intuitive to use, but it’s still fairly straight-forward. First, open Terminal by opening Spotlight (Command + Spacebar) and typing in terminal.

    To start a ping, just type the command as was shown in Windows: ping followed by the IP address or URL of the website, i.e. ping www.google.com.

    The main difference you’ll notice between using ping on Windows and Mac is that on macOS it just keeps going until you manually stop it. To stop pinging the device or URL, press Ctrl + C. That will bring you back to the main prompt.

    To see a list of all of the parameters you can use for ping on macOS, you can type man ping and get the help pages. There are a lot of switches, so take your time playing around with the different options.

    To get out of the man page, you have to simply press the q key on your keyboard. This will quit the man page and take you back to the prompt.

    The ping command is very versatile and is often the fastest way to figure out where the problem is on a network. We strongly recommend that you check out The Best Windows Command Line Network Commands for essential network diagnostic commands.

    Exit mobile version