kids encyclopedia robot

ping (networking utility) facts for kids

Kids Encyclopedia Facts
Ping
Ping iputils screenshot.png
Linux version of ping
Original author(s) Mike Muuss
Developer(s) Various open-source and commercial developers
Initial release 1983; 42 years ago (1983)
Platform Cross-platform
Type Command
License Public-domain, BSD, GPL, MIT

ping is a special computer program that helps you check if your computer can connect to another computer or website on the internet. It's like sending a quick "hello" message to see if someone is there and how long it takes for them to say "hello back." You can find this program on almost all computers and devices that connect to the internet.

The name "ping" comes from active sonar, which is a technology that sends out a sound pulse and listens for the echo to find objects underwater. In the same way, the `ping` program sends a small message and waits for a reply.

When you "ping" a computer, your computer sends a special message called an ICMP echo request. The other computer then sends back an ICMP echo reply. The `ping` program measures how long this whole trip takes. It also tells you if any messages got lost along the way. After the test, it gives you a summary, showing the fastest, slowest, and average times for the messages to travel.

The way `ping` looks and the options you can use might be a bit different depending on your computer's operating system. You can often choose how many messages to send, how big they are, and how long to wait for a reply. There's also a similar program called `ping6` for newer internet connections (called IPv6).

History of the Ping Command

Cmd-ping
An old version of ping running on DOS.

The `ping` program was created by a person named Mike Muuss in December 1983. He worked at the Ballistic Research Laboratory. Mike made `ping` to help figure out problems with computer networks. Another person, David Mills, suggested using special messages (ICMP echo packets) to test networks. This gave Mike the idea to create the tool.

Mike named it "ping" because it sounded like the noise sonar makes. Just like sonar uses echoes to find things, `ping` uses echoes (replies) to check network connections. The first version of `ping` was free for everyone to use. Later versions have different licenses, like the BSD license or GPL.

How to Use Ping: An Example

Here's an example of what you might see if you use `ping` on a Linux computer to send five messages to a website like www.example.com:

$ ping -c 5 www.example.com

PING www.example.com (93.184.216.34): 56 data bytes
64 bytes from 93.184.216.34: icmp_seq=0 ttl=56 time=11.632 ms
64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.726 ms
64 bytes from 93.184.216.34: icmp_seq=2 ttl=56 time=10.683 ms
64 bytes from 93.184.216.34: icmp_seq=3 ttl=56 time=9.674 ms
64 bytes from 93.184.216.34: icmp_seq=4 ttl=56 time=11.127 ms

--- www.example.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 9.674/10.968/11.726/0.748 ms

This output shows each message sent and its reply. The "time=" part tells you how many milliseconds (ms) it took for the message to go there and back.

At the end, you see a summary:

  • 5 packets transmitted, 5 packets received: This means all five messages were sent and all five got a reply.
  • 0.0% packet loss: No messages were lost. This is good! If it were higher, it would mean a bad connection.
  • round-trip min/avg/max: These numbers show the fastest (minimum), average, and slowest (maximum) times for the messages to travel. In this example, the average time was about 10.968 milliseconds.

Understanding Ping Errors

Sometimes, `ping` can't connect, or something goes wrong. When this happens, `ping` will show you an error message. These messages help you understand why the connection failed.

Here are some common error messages and what they mean:

  • H, !N or !P – This means the computer or network you're trying to reach can't be found. It's like trying to call a phone number that doesn't exist.
  • U or !W – This also means the destination computer or network is unknown.
  • A – or Z – This means the connection is blocked by a firewall or network rules. It's like a locked door preventing your message from getting through.
  • X – This is another message indicating that communication is blocked by rules.

When an error happens, the target computer or a device along the way sends back a special error message. This helps the `ping` program tell you exactly what went wrong.

How Ping Messages Work

When you use `ping`, your computer sends a small message called an ICMP packet. Think of this packet as a tiny digital envelope.

This "envelope" has two main parts:

  • Header: This part contains important information about the message, like where it's coming from and where it's going. It also has a "checksum" to make sure the message hasn't been changed during its journey.
  • Payload: This is the actual data inside the envelope. For `ping`, the payload often includes a timestamp (when the message was sent) and a sequence number (which message it is in a series). This helps `ping` figure out how long each message took to get a reply.

When the other computer receives your "echo request" message, it sends back an "echo reply" message. This reply message contains the exact same payload data that was sent in the request. This way, your computer knows which reply belongs to which request and can calculate the travel time accurately.

Security and Ping

While `ping` is a helpful tool, it can sometimes be used in ways that cause problems.

  • Ping Flood: Imagine if someone sent thousands of `ping` requests to a website all at once. This is called a ping flood. It can overwhelm the website's server, making it slow down or even crash, so real users can't access it. This is a type of denial-of-service attack.
  • Ping Sweeps: People can also use `ping` to quickly check many different computer addresses on a network. This is called a ping sweep. It can help them find out which computers are active on a network.

See also

  • fping
  • hping
  • Keepalive
  • nping
  • PathPing
  • Ping of death
  • Ping-pong scheme
  • Smurf attack
  • Traceroute