The ping command is one of the most often used networking utilities for troubleshooting network problems. Show You can use the ping command to test the availability of a networking device (usually a computer) on a network. When you ping a device you send that device a short message, which it then sends back (the echo).
A ping, according to the dictionary, is a sharp, high-pitched, and somewhat musical tone. You might associate it with the sound you hear when you tap a spoon against a crystal glass. In the IT world, it has a very different meaning. In this article, we will explain the basic concept of Ping, how the Ping utility works, and how it is utilized in the context of networking and network monitoring. What Is a Ping?A ping is a Command Prompt command that can be used to test a connection between one computer and another. Think of it in terms of sonar on a submarine. You’ve probably seen in the movies when the “ping” in the background as an audible signal is sent out to check a sub’s surroundings. When the ping strikes a nearby object, it will echo back. Operators can determine an object’s distance by the length of time it takes to return the echo. How Does a Ping Work?A ping is used to verify connectivity at an IP-level to a second TCP/IP device. It does this by transmitting Internet Control Message Protocol (ICMP) Echo Request messages and waits for a return message. Unless modified, the ping command will send 4 requests by default in Windows. How many responses get returned and how long it takes for the round-trip provide important information, such as:
The ping is initiated several times to test consistency in the connection. Here's what a successful ping request would return when connecting to a router. Why Would I Use Ping?If you’re ever run a speed test on your computer or network, you’ve used the ping command whether you knew it or not. You’re bouncing a message off a remote server and testing the amount of time it takes to return. Pings are useful for a variety of reasons, including troubleshooting connectivity, devices, and networks. Troubleshooting ConnectivityPing is used to troubleshoot connectivity. Most commonly, it’s used to verify the connection between two machines. You might use ping to test a network printer or copier connection to determine whether a device is offline or to verify you can connect to a router. If you’re having trouble with an application hosted over a network on a server, one of the first things you want to do is check the connection using a series of ping commands to help you narrow down the problem. If a ping comes back with fast response times, your connection is good so the problem likely lies with the server or application. You can also ping websites to see if they are operating and whether there’s a problem with the connection. Troubleshooting Networking IssuesAlmost any network-connected device will respond to a ping which makes it incredibly valuable to check networking connections. Ping can be used to test routers or servers for throughput and speed. You can also ping across a range of addresses to find each attached device in a particular range. You can test computer names and addresses of computers. When you can ping an IP address, but not a computer name, there’s likely a name resolution issue. If a ping comes back showing a successful connection but has long response times, you’re likely facing a routing, congestion, or networking issue. A ping command can be run manually or automated as a scheduled task for monitor network reliability. When a ping fails, there’s a problem. Ping Error MessagesIf the ping command does not get a response from the host, you will see either nothing returned or get a timeout notification. Since it's sending 4 requests, you'll likely see four time out notices. The Ping command allows you to add modifiers or parameters (also called switches) to customize the command for troubleshooting. Here is a list of the commands and the proper syntax in which to use them for Windows, although you will find slight variations for Unix.
Proper Ping SyntaxThe order in which you use these switches is important. Here’s is the proper syntax to use: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [-w timeout] [-R] [-S srcaddr] [-p] [-4] [-6] target [/?]
This article demonstrates how to use a ping test and traceroute tools to test network connectivity between two hosts. Ping performs a basic test to determine if a remote host is available, while traceroute tests the complete route network packets take from one host to another. Traceroute is especially helpful for diagnosing where network slowdowns and congestion occur. For a general introduction to network troubleshooting, please read this article first. Testing network connectivityMany scenarios require you to test things locally on your computer using the command line. For example, if you are trying to test the connection between your computer and a remote host, a web-based tool cannot provide this information. It only tests the connection from its own server to the remote host. The exact steps to use the ping and traceroute tools from the command line depend on your computer's operating system. Follow the appropriate procedures below for your operating system. Check host availability with ping testThe basic ping test is one of the easiest things you can do to verify connectivity between your computer and a remote host. This test is easy to run from the command line. Using ping test on Microsoft WindowsTo use the ping program on Microsoft Windows, follow these steps:
Using ping test on Apple Mac OS X and LinuxTo use the ping program on Mac OS X and Linux, follow these steps:
Testing the path to a remote host with tracerouteThe traceroute program provides much more detailed information about a connection to a remote host than ping. Traceroute (or tracert on Microsoft Windows systems) displays information about each “hop” a packet takes from your computer to the remote host. It is often a good way to pinpoint possible ISP connection issues or network bottlenecks. Using tracert on Microsoft WindowsOn Windows-based systems, use the tracert program to test the path to a server. To do this, follow these steps:
Using traceroute on Apple Mac OS X and LinuxTo use the traceroute program on Mac OS X and Linux, follow these steps:
Testing network connectivity with MTRMTR (“My Traceroute”) is a network diagnostic tool that combines the functionality of the ping and traceroute programs described above. It is a good way to monitor in real-time the path network packets take to their destination. Using MTR on Microsoft WindowsWinMTR is a version of MTR for computers running Microsoft Windows. To download WinMTR, use your web browser to go to https://sourceforge.net/projects/winmtr, and then install the program on your computer. After you install WinMTR, follow these steps to run a network test:
Using MTR on LinuxMTR may already be installed by your Linux distribution. If it is not installed, you can install it using your distribution's package manager (for example, apt-get or yum). After MTR is installed, follow these steps to run a network test:
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today. |