Sydney Staff SRE or something.

ping -f[aux flood]

· by Robert Mibus · Read in about 1 min · (191 Words)
ping sysadmin

I’m having trouble admitting this publicly, but I learnt something new recently about ping, of all things.

To quote from the man page of ping:

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

Seems reasonable enough. I mean, “flood” is pretty clear, right? Except, during troubleshooting this week I found that pinging a responding host and a non-responding host resulted in sending a different rate of packets.

Reading on in the man page, it becomes apparent why:

If interval is not given, it sets interval to
zero and outputs packets as fast as they come back or one hun‐
dred times per second, whichever is more. Only the super-user
may use this option with zero interval.

So what you really want, if you want a consistent number of packets per second, is to use the command like this:

ping -f -i 0.01

An interval of zero is actually an interval of “anything from zero to 10 milliseconds, depending on the RTT to the remote host”.