Broadcast ARP query to all nodes

arpnetworking

I am trying to broadcast an ARP query. I want to get every node's ip and mac address updated in my system via this query. So that I can type $arp and see all the nodes on my network and their corresponding physical addresses.

I have tried $ arping with no avail.

rafael@rcepeda:/var/www/html$ arping -s 192.168.1.9 -I wlan0 192.168.1.255
ARPING 192.168.1.255 from 192.168.1.9 wlan0
^CSent 37 probes (37 broadcast(s))
Received 0 response(s)

ifconfig for my interface

inet addr:192.168.1.9 Bcast:192.168.1.255 Mask:255.255.255.0

Regular broadcast ping

rafael@rcepeda:/var/www/html$ ping -b 192.168.1.255
WARNING: pinging broadcast address
PING 192.168.1.255 (192.168.1.255) 56(84) bytes of data.
^C
--- 192.168.1.255 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5040ms

100% packet loss

Is my router not letting me do this?

Best Answer

Most Linux distributions ignore ICMP echo broadcasts by default (kernel parameter net.ipv4.icmp_echo_ignore_broadcasts).

As far back as I could remember, Windows does not respond to ICMP echo broadcasts either. Maybe it could be overwritten by a registry modification but I do not know offhand.

This is discussed in the RFC 1122 standards document.

I would suggest using a bash script like this:

for i in 192.168.1.{1..254} 
do
  ping -c1 $i > /dev/null || true
  arp -an $i
done