Koozali.org: home of the SME Server

Linux gurus: PING hangs, when pinging unreachable device.

Offline NickCritten

  • *
  • 245
  • +0/-0
Linux gurus: PING hangs, when pinging unreachable device.
« on: August 01, 2005, 04:54:20 PM »
Wierd one this,

If I do a ping -c 10 <ipaddress> the server performs the 10 pings, but then hangs & I have to do a ctrl-c to recover.

I'm developing monitoring & diagnositic PHP / SQL system that automatically pings devices when you click hyperlinks.. It works fine if the device is live, but if the device is unreachable, it hangs and I have to restart httpd

I have googled for over 2 hours on this problem and can't find anything except a single post from 2002, where someone running RedHat7.3 was having the same problem...

Could this be a problem with the pre-compiled rpm for RH7.3? It seems to afflict 6.0, 6.0.1 and 6.5 ( I have access to several servers) I tried re-installing the iputils rpm from rpmfind.net but it has the sames problem.

I had a friend who is running Debian, and a Mandrake box to test this and they both return OK

I've logged this with bugtracker, but anyone got any Ideas?[/quote]
...
Nick

"No good deed goes unpunished." :-x...

Offline wellsi

  • *
  • 475
  • +0/-0
    • http://www.wellsi.com
Linux gurus: PING hangs, when pinging unreachable device.
« Reply #1 on: August 01, 2005, 09:23:01 PM »
A possible workaround is to add a -w to the command

On my network
ping -c 10 192.168.0.33
gave the behaviour you mention

ping -c 10 192.168.0.33 -w 5
is OK in so much as it returns rather than hangs.
............

Offline NickCritten

  • *
  • 245
  • +0/-0
Linux gurus: PING hangs, when pinging unreachable device.
« Reply #2 on: August 01, 2005, 10:38:07 PM »
Hi Wellsi, thanks for replying.

I've tried using the -w argument, however using the deadline also causes ping to return if it detects a single error, even one single ttl timeout will cause it to exit, which makes the ping useless as you are unable to see at which point the faulire occurs, and some devices don't reply to the first two or three pings anyway.
...
Nick

"No good deed goes unpunished." :-x...