Ping is a basic Internet tool that allows a user to verify that a particular IP address exists and can accept requests. The verb ping means the act of using the ping utility or command. Ping is used diagnostically to ensure that a host computer you are trying to reach is actually operating. If, for example, a user cannot ping a host, then the user will be unable to use the File Transfer Protocol (FTP) to send files to that host. Ping can also be used with a host that is operating to see how long it takes to get a response back. Using ping, you can learn the number form of the IP address from the symbolic domain name.
Loosely, ping means "to get the attention of" or "to check for the presence of" another party online. Ping operates by sending a packet to a designated address and waiting for a response. The computer acronym (for Packet Internet or Inter-Network Groper) was contrived to match the submariners' term for the sound of a returned sonar pulse.
Ping can also refer to the process of sending a message to all the members of a mailing list requesting an ACK (acknowledgment code). This is done before sending e-mail in order to confirm that all of the addresses are reachable.
The Internet Ping command bounces a small packet off a domain or IP address to test network communications, and then determines how long the packet took to make the round trip. The Ping command is one of the most commonly used utilities on the Internet by both people and automated programs for conducting the most basic network test: can your computer reach another computer on the network, and if so how long does it take?
Every second of the day there are untold millions of pings flashing back and forth between computers on the Internet like a continuous shower of electronic neural sparks. The following subsections provide information on how Ping was invented, how Ping works, how to use Ping, Ping web sites, and info on the original Unix Ping version.
How Ping was invented
The original PING command stood for "Packet Internet Groper", and was a package of diagnostic utilities used by DARPA personnel to test the performance of the ARPANET. However, the modern Internet Ping command refers to a program was written by Mike Muuss in December, 1983, which has since become one of the most versatile and widely used diagnostic tools on the Internet. Muuss named his program after the sonar sounds used for echo-location by submarines and bats; just like in old movies about submarines, sonar probes do sound something like a metallic "ping".
How Ping works
The Internet Ping program works much like a sonar echo-location, sending a small packet of information containing an ICMP ECHO_REQUEST to a specified computer, which then sends an ECHO_REPLY packet in return. The IP address 127.0.0.1 is set by convention to always indicate your own computer. Therefore, a ping to that address will always ping yourself and the delay should be very short. This provides the most basic test of your local communications.
How to use Ping
You can use the Ping command to perform several useful Internet network diagnostic tests, such as the following:
Access : You can use Ping to see if you can reach another computer. If you cannot ping a site at all, but you can ping other sites, then it is a pretty good sign that your Internet network is working and that site is down. On the other hand, if you cannot ping any site, then likely your entire network connection is down due to a bad connection.
Time & distance : You can use the Ping command to determine how long it takes to bounce a packet off of another site, which tells you its Internet distance in network terms. For example, a web site hosted on your neighbor's computer next door with a different Internet service provider might go through more routers and be farther away in network distance than a site on the other side of the ocean with a direct connection to the Internet backbone.
If a site seems slow, you can compare ping distances to other Internet sites to determine whether it is the site, the network, or your system that is slow. You can also compare ping times to get an idea of which sites have the fastest network access and would be most efficient for downloading, chat, and other applications.
Domain IP address : You can use the Ping command to probe either a domain name or an IP address. If you ping a domain name, it helpfully displays the corresponding IP address in the response.
You can run the ping command on a Windows computer by opening a command prompt window and then typing "ping" followed by the domain name or IP address of the computer you wish to ping. You can list the available options for the Windows ping command with "ping -?".
Online ping : If you can't use the Ping command from your own computer because of a firewall or other restriction, or want to do an Internet ping from another location than your own, you can use one of the following web sites that offer online ping services:
- his.com Ping
- Spfld.com Ping
- Theworldsend.net ping
Remember when doing an online ping that the packets are sent from that web site, so the times that are returned reflect the path from that location and not from your computer. Nevertheless, a ping from an online web site can be useful to test if an address can be reached from different places around the Internet, to do comparative timing to test how long it takes to reach one site compared to others.
If the times returned by several online ping sites to an Internet address are consistently long, then the destination site's network is likely having problems. On the other hand, if you can ping an address from an online ping site but not from your own computer, then there is likely some block in your network preventing you from communicating with that site.
Unix version : Muuss originally developed the ping command for the Unix system, with the options summarized below:
ping [-q] [-v] [-R] [-c Count] [-i Wait] [-s PacketSize] Host
|ping -c count||ping -c 10||Specify the number of echo requests to send.|
|ping -d||ping -d||Set the SO_DEBUG option.|
|ping -f||ping -f||Flood ping. Sends another echo request immediately after receiving a reply to the last one. Only the super-user can use this option.|
|ping host||ping 188.8.131.52||Specify the host name (or IP address) of computer to ping|
|ping -i wait||ping -i 2||Wait time. The number of seconds to wait between each ping|
|ping -l preload||ping -l 4||Sends "preload" packets one after another.|
|ping -n||ping -n||Numeric output, without host to symbolic name lookup.|
|ping -p pattern||ping -p ff00||Ping Pattern. The example sends two bytes, one filled with ones, and one with zeros.|
|ping -q||ping -q||Quiet output. Only summary lines at startup and completion|
|ping -r||ping -r||Direct Ping. Send to a host directly, without using routing tables. Returns an error if the host is not on a directly attached network.|
|ping -R||Ping -R||Record Route. Turns on route recording for the Echo Request packets, and display the route buffer on returned packets (ignored by many routers).|
|ping -s PacketSize||ping -s 10||Sets the packet size in number of bytes, which will result in a total packet size of PacketSize plus 8 extra bytes ICMP Header|
|ping -t||ping -t||No time out - keeps pinging indefinitely e.g. ping 192.168.0.1 -t|
|ping -v||ping -v||Verbose Output. Lists individual ICMP packets, as well as Echo Responses|
Network Connectivity Check
Two of the most practical connectivity test commands are ping and traceroute. These two commands are good mechanisms for network troubleshooting, and both of these use ICMP.
There are four easy steps defined for troubleshooting IP addressing:
- Ping 127.0.0.1
- Ping localhost IP address
- Ping default gateway
- Ping the remote server
Each of these could give information about the network status. Step 1 is generally a loopback test, which means the IP stack is initialized if successful. Then if Step 2 is successful, it means that the Network Interface Card (NIC) is functioning properly. Step 3 allows the user to find that the machine can communicate within the local network. Lastly, Step 4 gives the administrator the information of a host that successfully communicates with the remote server, where the remote physical server is working.
Ping is a computer program that determines if a host is up or not. Ping basically consists of a source sending an ICMP "echo request" to a target, followed by the target replying with an ICMP "echo response" - assuming the target is up. A typical output of Ping is shown in figure 1 and an Ethereal capture in figure 2:
Figure 1: Output of Ping command
Figure 2: ping Ethereal capture
Notice the ICMP echo request and reply comes up in the capture when a Ping command is performed. The Type and Code fields represent the different kinds of action and error results. A brief description of each is shown in the following table:
|0||0||echo reply (ping)|
|3||0||dest network unreachable|
|3||1||dest host unreachable|
|3||3||dest port unreachable|
|3||6||dest network unknown|
|3||7||dest host unknown|
|4||0||source quench (congestion control - not used)|
|8||0||echo request (ping)|
|12||0||bad IP header|
Traceroute is a computer program that sends ICMP packets to show the route a packet takes across an IP network from source to destination. It does this by incrementing the time-to-live (TTL) field by 1 for every successive host until it reaches its destination. A traceroute output and Ethereal capture are shown in figures 1 & 2, respectively.
Figure 3: Output of Traceroute command
Figure 4: traceroute Ethereal capture
Notice a TTL timeout message sent back to the source every time an ICMP message passes a network device. Then the source will record the router name.