HomeHow to use the Ping command to troubleshoot network problems

How to use the Ping command to troubleshoot network problems

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

What does it mean to use the Ping command?

Pinging something on a network means sending an Internet packet to a target computer or other network device, asking for a response. That device then sends you a package.

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

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

What is an Internet Package?

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

Packages are the fundamental units of the modern Internet. When you send data to someone, like a photo, it is broken up into small pieces. Each packet is tagged with a source and destination address and then sent to the Internet. These packets pass through many other computers, such as web servers and internet routers. Packets continue to be transmitted until they reach the destination system.

Connection problems with home WiFi- how to solve them

What you can use Ping for

The ping command has two main uses:

  • To check if your connection to a remote computer works.
  • To check how healthy that connection is.

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

What kinds of things can you ping?

  • In theory, you can ping anything with an IP address.
  • You can ping devices on your LAN to make sure they are connected properly.
  • You can also ping websites to see if you can reach them.

How to use Ping on Windows

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

  1. Open the Start menu, search for the command prompt and select it.
  2. Type Ping, then enter the IP address of the device or the URL of a site you want to ping.

We have used Google.com as an example below.

Once started, ping will send out four data packets.

A message for any packet that says “request timed out” implies that your computer has not received a response from the destination. If some packets are lost, some of the routing paths between the computer and the destination have a problem.

Useful modifiers to the Ping command for Windows

There are a few command options you can use with the ping command. Switches are extra options to customize the behavior of the ping command. If you want to see a full list of options, all you need to do is type ping/help at the command prompt and hit Enter. You will see the entire list, syntax and usage.

Below is a list of some command options that are useful for most users:

  • / t :Ping a target continuously for as long as you like. Press Ctrl + Break to pause the process and look at the current stats. To exit, press Ctrl + C.
  • / a – Resolves the host name of an IP address. This is useful if you have an IP address and want to know the web address associated with the specific server you are pinging.
  • / n X – Replace “X” with the number of pings you wish to send. The default is four. But if you want to better analyze the number of packets lost, send more pings to get a better idea of ​​how many packets are lost on average.
  • / w X – Replace “X” with the number of milliseconds you wish to wait before declaring a timeout. By default, this value is 4000 ms. If you think a connection might work but ping isn’t waiting long enough for a response, you can increase X to see if you’re right.
  • / l X – Replace “X” with a value in bytes to increase the size of each ping. By default, this value is 32, but you can increase it to 65527. This is useful to see if packet size is causing problems on the network. A 32-byte ping would work by default, but anything larger would result in packet loss.

How to use Ping on macOS

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

However, the latest versions have deprecated this utility in favor of Terminal. It’s not that intuitive to use, but it’s still quite simple. First, open Terminal by opening Spotlight ( Command + spacebar ) and typing terminal.

To initiate a ping simply type the command as shown in Windows- ping followed by the IP address or website URL, i.e. ping www.google.com.

The main difference you’ll notice between using ping on Windows and Mac is that on macOS it continues to work until you manually stop it. To stop ping the device, or URL, press Ctrl + C. This will take you back to the main prompt.

To see a list of all 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 exit the man page, simply press the q key on your keyboard. This will exit the man page and return you 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.

author image

About Author

Samuel Afolabi is a lazy tech-savvy that loves writing almost all tech-related kinds of stuff. He is the Editor-in-Chief of TechVaz. You can connect with him socially :)

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.