Use Linux ping in Cygwin

I need to work with a script that uses the ping command with its ordinary Linux syntax, neither Cygwin's default package or the Windows ping utility will work. For now, I've patched the script to use the Windows version (with some difficulty; the Windows executable doesn't provide useful return codes so I have to parse the output), but I'd like the out-of-the-box compatibility and additional features of the Linux ping. Before I get any further, let me state that I am running Cygwin in administrator mode; it's not a privilege issue. It's a versions issue.

Cygwin's default ping command is listed as being version '1.0-1' in the setup manager, in the package 'ping: a basic network tool to test IP network connectivity'. With no arguments, it outputs:

Usage:  ping [-dfqrv] host [packetsize [count [preload]]]

and the man page description begins with "The DARPA Internet is a large and complex aggregation of network hardware,", which reads as more than a little out of date to me. This is the version installed in /bin/ping.

Windows' ping command is located at $SYSTEMROOT/system32/ping, and outputs the following message on invocation without parameters.

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
        [-r count] [-s count] [[-j host-list] | [-k host-list]]
        [-w timeout] target_name

This is certainly a more feature-rich ping (notably, it includes timeouts, which is important to me), but it's not the version available on a modern Linux install:

ping [ -LRUbdfnqrvVaAB] [ -c count] [ -i interval] [ -l preload] [ -p pattern] 
     [ -s packetsize] [ -t ttl] [ -w deadline] [ -F flowlabel] [ -I interface] 
     [ -M hint] [ -Q tos] [ -S sndbuf] [ -T timestamp option] [ -W timeout] 
     [ hop ...] destination

documented online here. I can't seem to find references to the cygwin version of ping except in reference to Cygwin.

I found this ancient email thread which describes an early version of Cygwin without ping. I have not found any version of iputils designed for Windows.


You could either

  • try to build ping from source, it's part of the iputils package. But building stuff on cygwin can be quite the hassle.

Or (and I would try this first)

  • try another ping implementation, like this perl one in perl Net::Ping or one of the others on CPAN