Permanent and Original URL of this page: http://leuropa.eu/ping

#193 May 2007

Ping and Monitoring Service www.wormly.com

Linux Ping Examples
ping  -c2 -i0.2 -W5 rackspace.com &>> ping.txt

Windows Ping Examples
ping -a 10.0.99.221
resolve to its host name
ping -n 10 -l 1000 10.0.99.221
10 Echo Request messages, each of which has a Data field of 1000 bytes
ping -r 4 10.0.99.221
record the route for 4 hops
ping -j 10.12.0.1 10.29.3.1 10.1.44.1 10.0.99.221
specify the loose source route 10.12.0.1-10.29.3.1-10.1.44.1

PING
Das Programm "Ping" ist bekannt. Weniger bekannt ist der Entwickler dieser Software, Mike Muus. Dieser ist zwar bereits im Jahr 2000 bei einem Autounfall ums Leben gekommen. Doch auf seiner Homepage hat er in den Jahren zuvor einige nette Anekdoten zu "seiner" Software zusammengetragen. Und er hätte der Programmierung von Ping nach eigenen Worten vielleicht etwas mehr als nur ein paar Abendstunden gewidmet, wäre ihm im Jahr 1983 schon bewusst gewesen, dass das Programm das vielleicht berühmteste Werk seines Lebens wird. Eine der Anekdoten ist besonders schön: Bei Amazon, wo das Buch "The Story About Ping" zu kaufen ist, wurde von einem Käufer aus "Obervolta, Usbekistan" eine Rezension hinterlassen. Demnach ist dieses Buch eine "exzellente, aus hoher Warte verfasste Übersicht über die Diagnose-Software. (...) Ich kann das Buch allerdings für die meisten Manager nicht empfehlen, weil die technischen Aspekte vielleicht doch zu überwältigend sind und das grundlegende Konzept abschreckend wirken könnte". Es handelt sich dabei um ein im Jahr 1933 verfasstes illustriertes Kinderbuch, in dem das Leben der Gans Ping und ihre Wanderungen auf einem Fluß beschrieben werden.

Achso, fasst haette ichs vergessen! Anbei der Link für die Manager:
http://de.wikipedia.org/wiki/Ping

The Story of the PING Program

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. :-)

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.

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.

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 vapor.arl.army.mil (128.63.240.80): 56 data bytes
64 bytes from 128.63.240.80: icmp_seq=0 time=16 ms
64 bytes from 128.63.240.80: icmp_seq=1 time=9 ms
64 bytes from 128.63.240.80: icmp_seq=2 time=9 ms
64 bytes from 128.63.240.80: icmp_seq=3 time=8 ms
64 bytes from 128.63.240.80: icmp_seq=4 time=8 ms
^C
----vapor.arl.army.mil 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.'' Wow!

Want to see the source code ? (40k)

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 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.
The Story About Ping

Book cover: The Story About Ping The book by this title has nothing to do with networking, but that didn't prevent a reader from Upper Volta, Uzbekistan contributing this short but delightful review, which was was briefly seen at the Amazon.Com bookseller web site, and is saved here as part of the story about the other ping. *grin*

The Story About Ping by Marjorie Flack, Kurt Wiese (Illustrator)

Reading level: Baby-Preschool

Paperback - 36 pages (August 1977). Viking Pr; ISBN: 0140502416 ; Dimensions (in inches): 0.17 x 8.86 x 7.15

================================================================
Reviews

The tale of a little duck alone on the Yangtze River, The Story About Ping is a sweet and funny book with wonderfully rich and colorful illustrations. On a day like any other, Ping sets off from the boat he calls home with his comically large family in search of "pleasant things to eat." On this particular day, he is accidentally left behind when the boat leaves. Undaunted, the little duck heads out onto the Yangtze in search of his family, only to find new friends and adventures--and a bit of peril--around every bend.

The exceptional illustrations bring the lush Yangtze to life, from Ping's family to the trained fishing birds he finds himself among to the faithfully rendered boats and fishermen. Certainly intended to be read aloud, The Story About Ping deserves a place on every young reader's (or listener's) shelf. (Picture book)
Synopsis

A childhood classic. "Kurt Wiese and Marjorie Flack have created in Ping a duckling of great individuality against a background (the Yangtze River) that has both accuracy and charm."--The New York Times. Full-color illustrations.

Synopsis of the audio cassette edition of this title: A little duck finds adventure on the Yangtze River when he is too late to board his master's houseboat one evening.

Card catalog description: A little duck finds adventure on the Yangtze River when he is too late to board his master's houseboat one evening.

================================================================
Customer Comments

A reader from Upper Volta, Uzbekistan, March 7, 1999

Excellent, heart-warming tale of exploration and discovery. Using deft allegory, the authors have provided an insightful and intuitive explanation of one of Unix's most venerable networking utilities. Even more stunning is that they were clearly working with a very early beta of the program, as their book first appeared in 1933, years (decades!) before the operating system and network infrastructure were finalized.

The book describes networking in terms even a child could understand, choosing to anthropomorphize the underlying packet structure. The ping packet is described as a duck, who, with other packets (more ducks), spends a certain period of time on the host machine (the wise-eyed boat). At the same time each day (I suspect this is scheduled under cron), the little packets (ducks) exit the host (boat) by way of a bridge (a bridge). From the bridge, the packets travel onto the internet (here embodied by the Yangtze River).

The title character -- er, packet, is called Ping. Ping meanders around the river before being received by another host (another boat). He spends a brief time on the other boat, but eventually returns to his original host machine (the wise-eyed boat) somewhat the worse for wear.

The book avoids many of the cliches one might expect. For example, with a story set on a river, the authors might have sunk to using that tired old plot device: the flood ping. The authors deftly avoid this.

Who Should Buy This Book

If you need a good, high-level overview of the ping utility, this is the book. I can't recommend it for most managers, as the technical aspects may be too overwhelming and the basic concepts too daunting.

Problems With This Book

As good as it is, The Story About Ping is not without its faults. There is no index, and though the ping(8) man pages cover the command line options well enough, some review of them seems to be in order. Likewise, in a book solely about Ping, I would have expected a more detailed overview of the ICMP packet structure.

But even with these problems, The Story About Ping has earned a place on my bookshelf, right between Stevens' Advanced Programming in the Unix Environment, and my dog-eared copy of Dante's seminal work on MS Windows, Inferno. Who can read that passage on the Windows API ("Obscure, profound it was, and nebulous, So that by fixing on its depths my sight -- Nothing whatever I discerned therein."), without shaking their head with deep understanding. But I digress.

================================================================

Melissa Rondeau from Braintree, MA , March 11, 1999

I collect reference books about the UNIX operating system. PING (short for Packet InterNet Groper) has always been one of those UNIX commands whose usefulness transcends its own simplicity. A coworker told me about a book dedicated to this one command, "The Story About PING." I was a little surprised that an entire book was devoted to the history of this UNIX command, but the price was certainly affordable, so I ordered it from a distributor. What arrived was actually an illustrated story book for young children. I thought it was a mistake, but my coworker told me later he was just playing a prank. I did read the book on the plane while traveling on business, and I have to admit, it's one of the finest pieces of children's literature I have ever read. A classic tale of adventure and innocence, with an important lesson to be learned. Not what I originally expected, but an enjoyable read none the less.

================================================================

A reader from Houston, TX , November 25, 1998

A wonderful, timeless story of family, adventure and home I can remember Captain Kangaroo reading this book on his TV show and that was probably 30 years ago. A very delightful book which allows children to understand responsiblity, adventure, family and home. The story is simple and uncluttered, a small duck who decides to avoid the punishment due the last duck to board the boat each night - a whack on the back, by hiding and not boarding with the rest of the ducks.

Ping has his adventure and returns to the boat and his family, wiser yet innocent. Great story to share with your children.

================================================================

A reader from brunswick, jersey , November 30, 1997

I grew up on Ping and I love it still. I'm 21 now and buying it for every friend with a kid. Its clean, its fun, and its just great.

UP to Mike's Home Page.
WAY UP to the Lab's Home Page.
NEXT to the story of other great network tools.
< mike@arl.army.mil >

http://ftp.arl.mil/~mike/ping.html


Linux - ping man page


-a
    Audible ping.
-A
    Adaptive ping. Interpacket interval adapts to round-trip time, so that effectively not more than one (or more, if preload is set) unanswered probes present in the network. Minimal interval is 200msec for not super-user. On networks with low rtt this mode is essentially equivalent to flood mode.
-b
    Allow pinging a broadcast address.
-B
    Do not allow ping to change source address of probes. The address is bound to one selected when ping starts.
-c count
    Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets, until the timeout expires.
-d
    Set the SO_DEBUG option on the socket being used. Essentially, this socket option is not used by Linux kernel.
-F flow label
    Allocate and set 20 bit flow label on echo request packets. (Only ping6). If value is zero, kernel allocates random flow label.
-f
    Flood ping. For every ECHO_REQUEST sent a period ''.'' is printed, while for ever ECHO_REPLY received a backspace is printed. This provides a rapid display of how many packets are being dropped. If interval is not given, it sets interval to zero and outputs packets as fast as they come back or one hundred times per second, whichever is more. Only the super-user may use this option with zero interval.
-i interval
    Wait interval seconds between sending each packet. The default is to wait for one second between each packet normally, or not to wait in flood mode. Only super-user may set interval to values less 0.2 seconds.
-I interface address
    Set source address to specified interface address. Argument may be numeric IP address or name of device. When pinging IPv6 link-local address this option is required.
-l preload
    If preload is specified, ping sends that many packets not waiting for reply. Only the super-user may select preload more than 3.
-L
    Suppress loopback of multicast packets. This flag only applies if the ping destination is a multicast address.
-n
    Numeric output only. No attempt will be made to lookup symbolic names for host addresses.

-p pattern
    You may specify up to 16 ''pad'' bytes to fill out the packet you send. This is useful for diagnosing data-dependent problems in a network. For example, -p ff will cause the sent packet to be filled with all ones.

-Q tos
    Set Quality of Service -related bits in ICMP datagrams. tos can be either decimal or hex number. Traditionally (RFC1349), these have been interpreted as: 0 for reserved (currently being redefined as congestion control), 1-4 for Type of Service and 5-7 for Precedence. Possible settings for Type of Service are: minimal cost: 0x02, reliability: 0x04, throughput: 0x08, low delay: 0x10. Multiple TOS bits should not be set simultaneously. Possible settings for special Precedence range from priority (0x20) to net control (0xe0). You must be root (CAP_NET_ADMIN capability) to use Critical or higher precedence value. You cannot set bit 0x01 (reserved) unless ECN has been enabled in the kernel. In RFC2474, these fields has been redefined as 8-bit Differentiated Services (DS), consisting of: bits 0-1 of separate data (ECN will be used, here), and bits 2-7 of Differentiated Services Codepoint (DSCP).

-q
    Quiet output. Nothing is displayed except the summary lines at startup time and when finished.

-R
    Record route. (IPv4 only) Includes the RECORD_ROUTE option in the ECHO_REQUEST packet and displays the route buffer on returned packets. Note that the IP header is only large enough for nine such routes. Many hosts ignore or discard this option.

-r
    Bypass the normal routing tables and send directly to a host on an attached interface. If the host is not on a directly-attached network, an error is returned. This option can be used to ping a local host through an interface that has no route through it provided the option -I is also used.

-s packetsize
    Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.

-S sndbuf
    Set socket sndbuf. If not specified, it is selected to buffer not more than one packet.

-t ttl
    Set the IP Time to Live.

-T timestamp option
    Set special IP timestamp options. timestamp option may be either tsonly (only timestamps), tsandaddr (timestamps and addresses) or tsprespec host1 [host2 [host3 [host4]]] (timestamp prespecified hops).

-M hint
    Select Path MTU Discovery strategy. hint may be either do (prohibit fragmentation, even local one), want (do PMTU discovery, fragment locally when packet size is large), or dont (do not set DF flag).
-U
    Print full user-to-user latency (the old behaviour). Normally ping prints network round trip time, which can be different f.e. due to DNS failures.
-v
    Verbose output.
-V
    Show version and exit.
-w deadline
    Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. In this case ping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network.

-W timeout
    Time to wait for a response, in seconds. The option affects only timeout in absense of any responses, otherwise ping waits for two RTTs.

Windows Ping Parameters


<code>
Windows Ping Parameters

-t : Specifies that ping continue sending Echo Request messages to the destination until interrupted. To interrupt and display statistics, press CTRL-BREAK. To interrupt and quit ping, press CTRL-C.

-a : Specifies that reverse name resolution is performed on the destination IP address. If this is successful, ping displays the corresponding host name.

-n Count : Specifies the number of Echo Request messages sent. The default is 4.

-l Size : Specifies the length, in bytes, of the Data field in the Echo Request messages sent. The default is 32. The maximum size is 65,527.

-f : Specifies that Echo Request messages are sent with the Don't Fragment flag in the IP header set to 1. The Echo Request message cannot be fragmented by routers in the path to the destination. This parameter is useful for troubleshooting path Maximum Transmission Unit (PMTU) problems.

-i TTL : Specifies the value of the TTL field in the IP header for Echo Request messages sent. The default is the default TTL value for the host. For Windows XP hosts, this is typically 128. The maximum TTL is 255.

-v TOS : Specifies the value of the Type of Service (TOS) field in the IP header for Echo Request messages sent. The default is 0. TOS is specified as a decimal value from 0 to 255.

-r Count : Specifies that the Record Route option in the IP header is used to record the path taken by the Echo Request message and corresponding Echo Reply message. Each hop in the path uses an entry in the Record Route option. If possible, specify a Count that is equal to or greater than the number of hops between the source and destination. The Count must be a minimum of 1 and a maximum of 9.

-s Count : Specifies that the Internet Timestamp option in the IP header is used to record the time of arrival for the Echo Request message and corresponding Echo Reply message for each hop. The Count must be a minimum of 1 and a maximum of 4.

-j HostList : Specifies that the Echo Request messages use the Loose Source Route option in the IP header with the set of intermediate destinations specified in HostList. With loose source routing, successive intermediate destinations can be separated by one or multiple routers. The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses (in dotted decimal notation) separated by spaces.

-k HostList : Specifies that the Echo Request messages use the Strict Source Route option in the IP header with the set of intermediate destinations specified in HostList. With strict source routing, the next intermediate destination must be directly reachable (it must be a neighbor on an interface of the router). The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses (in dotted decimal notation) separated by spaces.

-w Timeout : Specifies the amount of time, in milliseconds, to wait for the Echo Reply message that corresponds to a given Echo Request message to be received. If the Echo Reply message is not received within the time-out, the "Request timed out" error message is displayed. The default time-out is 4000 (4 seconds).

Bookmark and Share

search

(c) Copyright Robert Redl, Vienna, Austria. All rights reserved.

Permanent and Original URL of this page: http://leuropa.eu/ping