LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2017, 01:10 PM   #1
unistan
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Rep: Reputation: Disabled
Windows vs Linux (Debian) Ping Behavior


Hi there,

I am currently trying to figure out how ping differs in Windows vs. Linux. I am trying to use ping to check the availability of a system. On a Windows computer, if I ping a computer (target system also Windows) going to sleep, it will receive replies before sleeping, time out during sleep, and receive replies after the system resumes.

On my Linux (Debian) system, even after the target system resumes, ping (I use -W 3 -O flags) will intermittently receive replies (perhaps 1 replied packet in 10) while the rest will say "not received answer yet". If I run an arp-scan on the target computer, or flush the ARP cache (run ip -s -s neigh flush all), then pings will be received as before.

How come flushing the ARP cache in Linux needs to happen before pings function as expected? Is there a difference in the implementation of ping?

Thanks.

Last edited by unistan; 06-27-2017 at 01:16 PM.
 
Old 06-27-2017, 02:39 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Hello and welcome to LQ.

In short, yes. Ping the program is different in every OS usually and in each version and each compilation. They are not the same program. They may have features that are similar and use similar paths to get to the work needed.


I'd look at arp -a before and after. Why it would change I can't say.
 
Old 06-28-2017, 05:57 AM   #3
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
Did the WinPC get a *different* IP address -after- resume? (yes, arp -a) tcpdump maybe

Good 'puzzle'! We'll 'get there'. Yes, Welcome
 
Old 06-28-2017, 06:08 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
There are systems which will reply on ping even when the system itself is already died (frozen, crashed, whatever). So ping is not really reliable if you want to check the availability of a system. I would rather try something better (for example a service).
Also the result of ping test depends on the other side too, not only the implementation of ping and the OS. How will you interpret if something/sometimes was sent back at all?
 
Old 07-08-2017, 12:44 PM   #5
unistan
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
I could not figure out the reason behind this behavior, but I was able to fix our programs that depend on ping to use arp-scan at the same time to force refresh of the ARP-cache. @pan64, this must be with hardware-implemented ICMP but I have not seen this with any of our computers.

I am looking into using redis instead and using a pub/sub approach. But further discussion, is certainly out of scope of this question. Thanks all.
 
Old 07-21-2017, 12:48 PM   #6
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by jefro View Post
Hello and welcome to LQ.

In short, yes. Ping the program is different in every OS usually and in each version and each compilation. They are not the same program. They may have features that are similar and use similar paths to get to the work needed.


I'd look at arp -a before and after. Why it would change I can't say.
what is the C code for ping under Linux? It might help to look moire into detailed of its job.. or action..


check here: ping.c

https://www.cise.ufl.edu/~cop4600/cg...mmands/simple/
 
Old 07-21-2017, 03:29 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Xeratul,

Can't say what the code is for ping the OP has. It is a very old program and every OS has some "build" of it. Windows of course would not be the same code base most likely. Some versions of linux and maybe QNX and such may have similar code base. First would be starting with the version of ping on some system. Also if it is some busybox version too. Busybox versions tend to be stripped. If ping came with a distro it ought to be documented.

The OP seems to be happy forcing arp I assume before ping or just by using arp scan to id mac to ip. There are other ways to fix this. I assume some set of switches are causing his issue maybe??
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to ping Windows 7 machines by name from Debian Server? keymoo Linux - Networking 3 03-13-2012 12:31 PM
Can ping but can't wget - strange network behavior donv2 Linux - Networking 1 04-29-2011 10:47 AM
strange behavior using system() and ping utility ggeorgak Programming 4 02-10-2007 05:55 AM
SAMBA behavior in a Linux / WIndows Environment DoctorWho Linux - Networking 6 02-12-2006 03:13 AM
Incomprehensible ping behavior Gmiadlicher Linux - Networking 1 02-25-2004 03:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration