0

When I run the ping command, I often do so with the goal in mind to learn when a particular machine has come up, e.g. from rebooting. But recently (read: in the last few years) I have noticed that after 10 or 15 seconds of not getting a reply, ping start getting extremely chatting, repeatedly displaying "Destination Host Unreachable" every second! This is extremely annoying. One of the great diagnostic uses of ping used to be that any output at all meant that the host was up.

So, how can I get rid of this stupid annoying behavior and have it only print actual pings? These "Destination Host Unreachable" are not going to stderr like I would expect a well behaved program to do with errors, so I can't redirect stderr to get rid of them!

2 Answers 2

1

"Destination host unreachable" is given, when the system does not know how to send the ping request to the remote host in the first place. It means that your system or a router in between does not have a routing table entry/rule that allows it forward the packet to the router responsible for that network.

And it is getting "extremely chatty" because this happens for every packet (i.e. it is not lost, but essentially you are getting a "don't know how to deliver this packet" message back for each).

You could filter them out via grep though

ping 192.168.5.1 | grep -v "host unreachable"
4
  • I may be wrong but I believe under Linux it will work in real time. Commented Oct 8, 2012 at 18:54
  • I stand corrected, I was being an idiot, downvote removed, upvote added.
    – terdon
    Commented Oct 8, 2012 at 18:55
  • Much appreciated. Commented Oct 8, 2012 at 18:58
  • why does the system not know how to send the ping when it's on the same subnet as the originator?
    – Michael
    Commented Sep 10, 2020 at 21:06
0

The -i option could help you(from the ping man page):

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .