Ping -c1, wait for all responses from broadcast

networkingping

I want to send one packet to the broadcast address, but wait for all responses.

If I do ping -c 1 192.168.1.255, it sends just one packet, but it quits after getting the first response.

Best Answer

How would ping know that the responses it got really are all of them?

To find out which hosts on a subnet are up, something like nmap is well suited. See the -sn argument for Host Discovery:

-sn (No port scan)

This option tells Nmap not to do a port scan after host discovery, and only print out the available hosts that responded to the scan. This is often known as a “ping scan”,[...]

Systems administrators often find this option valuable as well. It can easily be used to count available machines on a network or monitor server availability. This is often called a ping sweep, and is more reliable than pinging the broadcast address because many hosts do not reply to broadcast queries.

Related Question