There is one solaris command to ping all the hosts in the subnet by issuing :

ping -s

Is there anything similar to this one in linux ? My intention is to find one mac address as below after pinging all the hosts:

arp -an | grep mac_address
  • 1
    fping can do this. fping -c 1 -g – Sven Dec 26 '16 at 13:00
  • I usually use ping6 -nc2 ff02::1%eth0 though it is not exactly the same as you ask for. – kasperd Dec 26 '16 at 20:11

All you are doing is pinging the broadcast address. The GNU/Linux version of ping requires that you use the -b switch

-b Allow pinging a broadcast address

There doesn't appear to be a direct equivalent of the Solaris -s switch either (it's only pinging every second and gathering stats) but perhaps it's buried in the Linux man pages- well worth a read (as may be the Solais ones ).

I wouldn't go pinging either (it may take a while to complete) I'd use the broadcast address of the network I was connected to.


You can always try to ping to the broadcast address of your subnet. It depends on your local network setup, but you can find it out with

$ ifconfig wlp4s0 | grep Bcast
      inet addr:  Bcast:  Mask:

Pinging from Linux requires the -b commandline switch, which is kind of a precaution of the command.

However, this does not guarantee that you will collect all MAC addresses from all devices connected to your subnet as it is up the the very device to actually answer ICMP ECHO requests sent to broadcast addresses, even if that was intended otherwise in the early ages of the TCP/IP RFCs (see whether /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts is set to 1).

To be more sure to cover all addresses, ping them individually with

$ for ip in 192.168.199.{1..254}; do ping -c1 ${ip} & done

More or less the same is achieved if you use a special scan type of nmap with

$ sudo nmap -sn -PE -n

That is also my recommended way of probing since you can fine tune the way you ask the clients for their MAC addresses.



ping -b

at where ifconfig show broadcast address is

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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