Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

"Ping" doesn't work properly

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2006, 01:29 AM
Default "Ping" doesn't work properly



I only want to send one packet to another host to check whether it is
connected or not. I want to have 2 seconds timeout.

I use, ping -c 1 -w 2 192.168.0.2

If host is not connected, it fails correctly. BUT summary says.

PING 192.168.0.2 from 192.168.0.1 : 56(84) bytes of data

--------192.168.0.2 ping statastics --------
2 packets transmitted, 0 received, 100% loss, time 999ms

Why 2 packets are sent instead of 1 (specified) and why it only waits
for 999 ms instead of 2 seconds.

Even if I use: ping -c 5 -w 2 192.168.0.2, it has the same result. Here
I wanted to send 5 packets but, again 2 packets were sent?

What is wrong here? Please help me.
Thanks a lot



Neel
Reply With Quote
  #2  
Old 02-14-2006, 07:29 PM
Rick Jones
Guest
 
Posts: n/a
Default Re: "Ping" doesn't work properly

Neel <(E-Mail Removed)> wrote:
> I only want to send one packet to another host to check whether it is
> connected or not. I want to have 2 seconds timeout.


> I use, ping -c 1 -w 2 192.168.0.2


> If host is not connected, it fails correctly. BUT summary says.


> PING 192.168.0.2 from 192.168.0.1 : 56(84) bytes of data


> --------192.168.0.2 ping statastics --------
> 2 packets transmitted, 0 received, 100% loss, time 999ms


> Why 2 packets are sent instead of 1 (specified) and why it only waits
> for 999 ms instead of 2 seconds.


The two vs one may simply be an OBO bug (off by one) - send one right
away, send one after the first timeout. (Double check that the manpage
for your ping's -c option matches your expectation of course The
999ms could be that the ping command got some other indication that
the response wasn't going to arrive - sometimes I've seen messages
elsewhere that imply that ARP sent something up the stack that said it
couldn't map the IP to a MAC - perhaps that makes it all the way to
ping which then "knows" that waiting for the full timeout is
pointless.

Might be worthwhile doing a system call trace of the ping command.

> Even if I use: ping -c 5 -w 2 192.168.0.2, it has the same result. Here
> I wanted to send 5 packets but, again 2 packets were sent?


Might check the ARP tables and the ARP timeouts. If the system is not
up, and is "local" then the gating factor might be ARP not ping.

rick jones
--
oxymoron n, commuter in a gas-guzzling luxury SUV with an American flag
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
Reply With Quote
Reply

Tags
ping, properly, work

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 02:07 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.