Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I want to ping all possible IPs in my LAN, and I have the code for it, but right now, I've already cut the weight time from 5s to 2s, and it's still about 8 minutes to test them all. How long should it take to ping an IP on my same LAN?

Thanks

share|improve this question
    
You may get more answers by posting a question like this to the unix.stackexchange.com –  Jeff Welling Aug 8 '11 at 7:00
    
I can do this with nmap in a few seconds. You have to do it in parallel. Take a loop at nmap here: nmap.org –  Fake Name Aug 8 '11 at 7:44
add comment

3 Answers

up vote 2 down vote accepted

It should take less than a millisecond to ping a host on the same physical network. In reality, networks get busy and hosts get slow - it might take 5 milliseconds.

Like UDP, there is no guarantee that you'll receive a reply at all.

share|improve this answer
    
What's UDP? And why is there no guarantee? –  JShoe Aug 8 '11 at 1:26
    
How do I choose a -W time under 1? 0.01? It still seems slow to me. Is there a minimum you can't go under? –  JShoe Aug 8 '11 at 1:29
1  
Both ICMP (ping) and UDP are protocols with no built-in reliability. Your ping packet might collide with another packet on the way to the host. The host might lose it before it gets answered. There's no recovery mechanism built into these protocols (unlike TCP, where the protocol will retransmit until the packet is answered). You might want to look at 'fping' which lets you ping more than one host at a time. –  zzz Aug 8 '11 at 1:33
    
add comment

You can also try broadcast pings, but those are usually not routed. E.g. if you're on 192.168.0.0/24 network, you can try ping 192.168.0.255 and all hosts on same network will respond.

share|improve this answer
add comment

I would suggest using Nmap instead. It's designed for doing this kind of thing and can scan very large networks quite quickly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.