The CreatorCon Call for Content is officially open! Get started here.

SlightlyLoony
Tera Contributor

find_real_file.pngIn a conversation last week, one of our customers asked "What exactly does Ping do, anyway? I use it all the time, but I don't know how it actually works!"

Well, that's a fair question. If your background doesn't happen to include IP networking, how Ping actually works may well be a bit of a mystery to you as well. If so, read on!

Suppose we are using a computer named chimp, and from that computer we type ping orang to ping the computer named orang. Our computer does these things:

  1. Uses DNS to look up the IP address of the computer orang.
  2. Sends an ICMP Echo Request packet to that IP address.
  3. Listens for an ICMP Echo Response packet from that IP address.
  4. If an ICMP Echo Response packet is received in a reasonable time, prints a message telling you how long it took between the ICMP Echo Request and the ICMP Echo Response (this is often called the ping time).
  5. If an ICMP Echo Response packet is not received in a reasonable time, prints a message telling you that the ping attempt timed out.

find_real_file.pngThe ICMP packets are transmitted over the network in the same fashion as any other IP packet: they may be shuttled through any number of routers and switches between the two computers involved (in this case, chimp and orang). The ping time is generally related to how many routers and switches the packet must transit, and how busy (or congested) those network devices are.

ICMP (including the ICMP Echo Request/Response packets) is one of the most basic Internet protocols. Nearly all devices have ICMP enabled at a very low level, meaning that ICMP will work if the device is alive at all. It is possible for a firewall to block ICMP Echo Request/Response packets, or for the ICMP Echo function to be disabled on a device. However, this is very uncommon on devices like computers and printers (it's more common on firewalls, switches, and routers).

Ping is often used as a very basic test of whether a device is "there" or not. By "there", I mean that the device is turned on, is at least basically functioning, is plugged into the network, and the network between my computer and the one I'm pinging is working. This is exactly what Discovery uses Ping for — to see if there is a device at a particular IP address...

Wikipedia has good articles on Ping and ICMP.