Home » Hacking » Story by Author of PING for UNIX

by 5 comments

Yes, it's true! I'm the author of ping for UNIX. Ping is a little thousand-line hack that I wrote in an evening which practically everyone seems to know about. :-)

My original impetus for writing PING for 4.2a BSD UNIX came from an offhand remark in July 1983 by Dr. Dave Mills while we were attending a DARPA meeting in Norway, in which he described some work that he had done on his Fuzzball LSI-11 systems to measure path latency using timed ICMP Echo packets.

It's a Sonar Analogy

From my point of view PING is not an acronym standing for Packet InterNet Grouper, it's a sonar analogy. However, I've heard second-hand that Dave Mills offered this expansion of the name, so perhaps we're both right. Sheesh, and I thought the government was bad about expanding acronyms! :-)

Phil Dykstra added ICMP Record Route support to PING, but in those early days few routers processed them, making this feature almost useless. The limitation on the number of hops that could be recorded in the IP header precluded this from measuring very long paths.

I was insanely jealous when Van Jacobson of LBL used my kernel ICMP support to write TRACEROUTE, by realizing that he could get ICMP Time-to-Live Exceeded messages when pinging by modulating the IP time to life (TTL) field. I wish I had thought of that! :-)

Of course, the real traceroute uses UDP datagrams because routers aren't supposed to generate ICMP error messages for ICMP messages.

The best ping story I've ever heard

The best ping story I've ever heard was told to me at a USENIX conference, where a network administrator with an intermittent Ethernet had linked the ping program to his vocoder program, in essence writing:

ping goodhost | sed -e 's/.*/ping/' | vocoder

He wired the vocoder's output into his office stereo and turned up the volume as loud as he could stand. The computer sat there shouting "Ping, ping, ping..." once a second, and he wandered through the building wiggling Ethernet connectors until the sound stopped. And that's how he found the intermittent failure.

PING - 1983

Where a computer like the ENIAC is equipped with 18,000 vacuum tubes and weighs 30 tons, computers in the future may have only 1,000 vacuum tubes and weigh only 1 1/2 tons. Popular Mechanics, March 1949

I named it after the sound that a sonar makes, inspired by the whole principle of echo-location. In college I'd done a lot of modeling of sonar and radar systems, so the Cyberspace analogy seemed very apt. It's exactly the same paradigm applied to a new problem domain: ping uses timed IP/ICMP ECHO_REQUEST and ECHO_REPLY packets to probe the "distance" to the target machine.

Very First "ping" packet

In December of 1983 I encountered some odd behavior of the IP network at BRL. Recalling Dr. Mills' comments, I quickly coded up the PING program, which revolved around opening an ICMP style SOCK_RAW AF_INET Berkeley-style socket(). The code compiled just fine, but it didn't work -- there was no kernel support for raw ICMP sockets! Incensed, I coded up the kernel support and had everything working well before sunrise. Not surprisingly, Chuck Kennedy (aka Kermit) had found and fixed the network hardware before I was able to launch my very first "ping" packet. But I've used it a few times since then. *grin* If I'd known then that it would be my most famous accomplishment in life, I might have worked on it another day or two and added some more options.

The folks at Berkeley eagerly took back my kernel modifications and the PING source code, and it's been a standard part of Berkeley UNIX ever since. Since it's free, it has been ported to many systems since then, including Microsoft Windows95 and WindowsNT. You can identify it by the distinctive messages that it prints, which look like this:

PING ( 56 data bytes
64 bytes from icmp_seq=0 time=16 ms
64 bytes from icmp_seq=1 time=9 ms
64 bytes from icmp_seq=2 time=9 ms
64 bytes from icmp_seq=3 time=8 ms
64 bytes from icmp_seq=4 time=8 ms
^C PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
round-trip (ms)  min/avg/max = 8/10/16


In 1993, ten years after I wrote PING, the USENIX association presented me with a handsome scroll, pronouncing me a Joint recipient of The USENIX Association 1993 Lifetime Achievement Award presented to the Computer Systems Research Group, University of California at Berkeley 1979-1993.

Presented to honor profound intellectual achievement and unparalleled service to our Community. At the behest of CSRG principals we hereby recognize the following individuals and organizations as CSRG participants, contributors and supporters.


Download src

Want to see the source code? (40k) [alt]

Original Author Info

Sadly, Mike Muuss was killed in an automobile accident on November 20, 2000.
His work lives on in testament to his intellect and indomitable spirit -- Lee A. Butler

The Story of the PING Program

Author's Computer History Archive

The author also has a very interesting archive on computer history.

The Purpose of This Archive

  1. To help the public remember that it was the U. S. Army which initiated the computer revolution. Few inventions have had as big an impact on our civilization as the computer, and all modern computers are descended from ENIAC, EDVAC, ORDVAC, and BRLESC -- all of which were conceived of and built to address pressing Army needs.
  2. To give credit to the highly skilled and dedicated military and civilian scientists and other workers through whose efforts, together with their counterparts in the private sector, met and solved a great national defense challenge while at the same time giving birth to a technology which would change the world.
  3. To ensure that detailed information about and photographs of these early machines not vanish with the passage of time. Because of the ENIAC's vital role in the design of the hydrogen bomb and in gunnery calculations, much of the design information was originally classified, and few copies of the (now de-classified) reports still exist.

Fun Network Hacks

Along with PING, there are a few other fun bits of network code that I got to write back in the early days of TCP/IP.

Some other bits of kernel code that I've originated include the "default route" support, which a lot of people depend on to get their packets to an InterNet router when the full generality of a dynamic routing protocol is not required, or isn't working.

I also devised the "TCP max segment size (MSS) follows departing interface maximum transmission unit (MTU)" algorithm, which greatly improved TCP/IP efficiency in the face of dropped datagrams by allowing TCP to avoid using IP fragmentation.

I then further extended the algorithm to bring BSD UNIX into strict conformance with the TCP specification, and limit the TCP segment size when transmitting to faraway systems to 576 bytes. This is the origin of the "subnets-are-local" flag, which sometimes frustrates LAN sys-admins, but allowed mail to flow to Multics and Univac machines which (back then) adhered to the letter of the specification and could only handle 512 byte TCP segments. Since at the time I was the moderator of the TCP-IP Digest, the Unix-Wizards Digest and the INFO-UNIX Digest, I had a lot of packets to send to Multics and Univac machines, and the mail had to go through.

The TTCP Program

Along with Terry Slattery (then of the US Naval Academy), we took inspiration from an (Excelan? Interlan?) network test program, and evolved it into a program called TTCP, to "Test TCP". In addition to performing its intended function of testing TCP performance from user-memory to user-memory, TTCP has remained an excellent tool for bootstrapping hosts onto the network, by providing (essentially) a UNIX "pipe" between two machines across the network. For example, on the destination machine, use:

ttcp -r | tar xvpf -

and on the source machine:

tar cf - directory | ttcp -t dest_machine

To work around routing problems, additional intermediate machines can be included by:

ttcp -r | ttcp -t next_machine

TTCP has become another standard UNIX networking tool.


Comments Welcome

Information is freedom. Freedom is non-negotiable. So please feel free to modify, copy, republish, sell, or use anything on this site in any way at any time ;)

My Online Tools

Popular Articles
Hacking and Hackers

The use of "hacker" to mean "security breaker" is a confusion on the part of the mass media. We hackers refuse to recognize that meaning, and continue using the word to mean someone who loves to program, someone who enjoys playful cleverness, or the combination of the two.
-- Richard M. Stallman

It's very simple - you read the protocol and write the code. -Bill Joy

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. NCSA HTTPd.
UNIX ® is a registered Trademark of The Open Group. POSIX ® is a registered Trademark of The IEEE.

+Askapache | |

Site Map | Contact Webmaster | License and Disclaimer | Terms of Service | @Htaccess

↑ TOPMain