Network Troubleshooting Basics: The Ping Command

Ryan D. Lang
May 12, 2011
Updated • Mar 13, 2018
Network
|
12

This article is the first in a series delving into the basics of network troubleshooting. It covers what tools to use and how to use them. While this is a basic tutorial, there are some advanced tips and topics included. The focus will be on Windows based systems (with a tip or two for others).

Overview

Knowing the basics of network troubleshoot can help you find out where problems are. It could be your computer, your home router, your ISP (Internet Service Provided), the website itself, or something in between. First each tool will be looked at individually and then the process with be explained. The tools used will be the commands ping, ipconfig, and tracert. The process that will be covered is one of the most basic ones.

  • Step 1: Ping yourself with the loopback address.
  • Step 2: Ping the router (default gateway) and how to get that address (ipconfig).
  • Step 3: Ping or tracert outside the network (e.g. the Internet).

The Ping Command Basics

The ping command got its name from the sound sonar makes when it "sees" something. In sonar, you send out a signal and measure the time it takes to get there. The ping command does the same thing. This tells if a computer or device is out there or not, which is the purpose of the command.

To use the ping command, you type "ping" followed by an IP number or a website name. It will show you if a destination is reachable and how long it takes to get there. It will work in Windows from the Dos Box, Linux from the terminal, and Mac from the terminal (or the Network Utility).

Click on the "Start" button > "run" > and type in "cmd" & enter to bring up the command line.

Type in ping ghacks.net and hit enter (there is a space between the two g's).

The Loop-Back Address

Step 1 in the process is to ping yourself. To do that, we use the loop-back address. This is a special IP number, 127.0.0.1, and is useful in checking your own computer. When you ping this IP number, you ping your computer to test if the system is working. It is an internal process. If this does not work, you know the problem is in your computer. In this case, you may simply need to reboot the machine, but it could be a more serious issue.

Type in ping 127.0.0.1 and hit enter (there is a space between the "g" and the "1").

Exceptions to the Rule

When it comes to websites and servers, not all of them will let you ping them. For example, Microsoft's website will not show up if you ping it, but Google will. These sites, while working, will give you a "Request timed out." error message.

How can a website show up on your browser and not on the ping command? The Internet works using a system of standard instructions called protocols, TCP in a website's case. The ping command works with another protocol called ICMP. The main use for ICMP is to test connections and find out where a problem is. It is supposed to send back information to the sender letting them know if the message was received. If you turn off ICMP, then ping will not work. A firewall is usually used to do this.

In school, when we tried to ping classmates; this was a problem. With the firewall on, we could not ping each other until we turned it off. That is not something you should do at home, but it can explain why you cannot ping a computer on your home network. If you do decide to try out something that requires turning off your firewall (not recommended), unplug your router from the Internet and do not plug it back in until your firewall is running again.

Ping Command Options

The ping command will try to reach site four times by default. Personally, I think twice is enough. You can limit the number of times by using some switches. Switches are extra text you include with a command to tweak what it does.

  • In MS Windows, use ping -n 2 destination
  • In Linux, use ping -c 2 destination
  • On a Mac, use ping -c 2 destination

Some people think once or thrice is enough, so feel fee to swap that 2 for a 1 or a 3. There are more options too, but this is what I find useful. You can always type "ping" by itself to see all the options (in dos, ping /? works too). Tip: If you are using Linux, and the ping command just keeps going, use ctrl+c to stop it.

Closing

The first step is to ping yourself. The next step is to ping your router. To do that you need to know how to use the ipconfig command, which will be covered in the next article.

Summary
Network Troubleshooting Basics: The Ping Command
Article Name
Network Troubleshooting Basics: The Ping Command
Description
This article is the first in a series delving into the basics of network troubleshooting. It covers what tools to use and how to use them.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Previous Post: «
Next Post: «

Comments

  1. Rahul said on September 14, 2012 at 7:45 am
    Reply

    Suppose (10.0.51.35, 192.168.2.1,192.168.3.1,192.168.4.45,192.169.2.1) this is my ip group.

    Any command available in check Ping at a time All IP.
    OR
    Any Idea’s…???
    Pls Rpy…

  2. Rahul said on September 14, 2012 at 7:39 am
    Reply

    Supposes (192.168.2.1, 192.168.2.9, 192.168.4.5, 192.169.2.1, 10.0.50.1) this is my ip group.

    Any commands available in check ping all ip at a time.
    OR
    Any idea..?
    Pls Reply me….

    1. Joshua said on October 30, 2018 at 8:35 am
      Reply

      you can open multiple tabs in command prompt by typing start. Then in each window type the following: ping -t 192.168.2.1 on the first tab. ping -t 192.168.2.9 on the second and so on. What this will do is it will not stop pinging the adress until you close the tab or stop the command process by using Ctrl+C.
      Enjoy!

  3. Jo said on May 12, 2011 at 8:26 pm
    Reply

    Ctrl-z do not stop ping but ctrl-c does it.

    Ctrl-z get your command running in background. You can write the command “fg” to get back to “ping”

    1. Ryan D. Lang said on May 13, 2011 at 7:13 am
      Reply

      I’m somewhat embarrassed, but thank you sincerely. It seems I was misinformed (or misunderstood) when I was taught the command. I will have to be more careful when researching commands and verify my Linux knowledge. That said, this is important for me to know, so I am glad you commented.

  4. fokka said on May 12, 2011 at 11:19 am
    Reply

    thanks for the interesting article!
    although im a computer “geek” since many years, networks is something i couldnt get behind – yet. so i appreciate every little tip you have for solving network-problems :)

    1. Ryan D. Lang said on May 12, 2011 at 4:48 pm
      Reply

      I’m glad you came away with something. I’m working on the next article in another window right now. I’m not sure what OS you are using, but I am trying to have some information for Linux and Mac too (and Macs require some research, so I’m learning too). The idea is that you can come back to these article even if you switch to a new OS. I use Ubuntu, XP, Vista, and Win7 regularly these days, so I know how that can be.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.