Here's a script that will find all1 of the Raspberry Pi's on your local network:
#!/bin/sh
: ${1?"Usage: $0 ip subnet to scan. eg '192.168.1.'"}
subnet=$1
for addr in `seq 0 1 255 `; do
( ping -c 3 -t 5 $subnet$addr > /dev/null ) &
done
arp -a | grep -E --ignore-case 'b8:27:eb|dc:a6:32'
chmod 755 pingpong.sh
- execute it (use your network address here, not necessarily 192.168.1.):
./pingpong.sh 192.168.1.
Your output may look like this: This output reflects my network; it has 2 RPis connected, and one of them is a 3B+ with WiFi enabled and the other an oldie 1bp connected via Ethernet:
raspberrypi3b.local (192.168.1.144) at b8:27:eb:12:34:56 on en0 ifscope
raspberrypi1bp.local (192.168.1.179) at b8:27:eb:78:9a:bc on en0 ifscope
Notes:
1. All Pi's that have a MAC address whose first 24 bits are one of the two OUI numbers assigned to the Raspberry Pi Foundation. This may not include Pi's using 3rd party network hardware, or those whose MAC address has been 'spoofed'.
nmap
seems to only find about half my devices (pi and non-pi) - probably a problem with nmap rather than the piarp -n raspberrypi.local
will show the address of your Pi (assuming it is in contact with the host)