Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When I ping a host and host is available - I receive an answer within no time.
When the host is not available - it lasts about 5 second before I get an answer.
I need to scan my LAN to know who is online. So 5 seconds per host is too much.
Is there some quick and durty way to do it?
I seem to remember that you can use the -w parameter with the ping command to set a timeout value (in milliseconds), so you might want to try using that.
Try ping -b <bcast> for a few seconds and then filter the data. This may not always give you all the hosts. Also you may try -W option (ping -c 1 -W 1 <ip>).
I seem to remember that you can use the -w parameter with the ping command to set a timeout value (in milliseconds), so you might want to try using that.
Thank you, very nice. I use -w 1 and it is decreased to 1 second. Is 1 second the minimum?
When I try to use -w 0.1 - it doesn't work.
I need to scan my LAN to know who is online. So 5 seconds per host is too much.
Try fping. It is good to pinging several hosts with a single command and it has controls to limit the number of pings in each hosts and time (e.g. fping -B 1 -c 1)
I am sorry, but here, I replay your command changing only the net range, and I can't tell there is a significative difference between consecutive runs.
Code:
# time fping -a -B 1 -r 1 -g 192.168.155.150 192.168.155.200 -s -t 1
--output cuted ---
51 targets
1 alive
50 unreachable
0 unknown addresses
100 timeouts (waiting for response)
101 ICMP Echos sent
1 ICMP Echo Replies received
84 other ICMP received
0.52 ms (min round trip time)
0.52 ms (avg round trip time)
0.52 ms (max round trip time)
4.489 sec (elapsed real time)
real 0m4.492s
user 0m0.000s
sys 0m0.000s
# time fping -a -B 1 -r 1 -g 192.168.155.150 192.168.155.200 -s -t 1
--output cuted ---
51 targets
1 alive
50 unreachable
0 unknown addresses
100 timeouts (waiting for response)
101 ICMP Echos sent
1 ICMP Echo Replies received
80 other ICMP received
0.20 ms (min round trip time)
0.20 ms (avg round trip time)
0.20 ms (max round trip time)
4.397 sec (elapsed real time)
real 0m4.403s
user 0m0.000s
sys 0m0.000s
# time fping -a -B 1 -r 1 -g 192.168.155.150 192.168.155.200 -s -t 1
--output cuted ---
51 targets
1 alive
50 unreachable
0 unknown addresses
100 timeouts (waiting for response)
101 ICMP Echos sent
1 ICMP Echo Replies received
84 other ICMP received
0.59 ms (min round trip time)
0.59 ms (avg round trip time)
0.59 ms (max round trip time)
4.487 sec (elapsed real time)
real 0m4.492s
user 0m0.004s
sys 0m0.000s
#
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.