Find all the #RaspberryPi on your network from Linux

I was at work running a Pi headless… And I realised I had no way of knowing what the IP address was. I’d tried using Angry IP Scanner but, for some reason, this failed to work. After a little Googling, I found this answer on the Raspberry Pi forums from well-known Pi guru Gordon Henderson.

This only works from Linux, but is useful to know:

If e.g. your LAN is 192.168.254.0/24 then create a bash script:

#!/bin/bash
# findPi:
#       Find all Pi's on the LAN

fping -a -r1 -g 192.168.254.0/24  &> /dev/null
arp -n | fgrep " b8:27:eb"

This produces:

192.168.254.30           ether   b8:27:eb:a5:16:f6   C                     eth0
192.168.254.33           ether   b8:27:eb:94:39:fd   C                     eth0
192.168.254.31           ether   b8:27:eb:87:37:da   C                     eth0

This works because all Pis have MAC addresses beginning with b8:27:eb (this info also found on the Raspberry Pi forum thread)

7 comments for “Find all the #RaspberryPi on your network from Linux

  1. 23 February 2013 at 5:26 am

    Im using a different method to do that. I installed sendemail on raspberry pi and with the help of a script im sending to my gmail an email that contains the IP of the raspi….

    • 23 February 2013 at 9:42 am

      I’ve done that in the past. I sometimes had trouble with knowing _when_ to place the script in the start-up sequence (I’m not a Linux guru). Also, at the time I didn’t have access to the Pi to install anything or test it out, so the scan-and-find method was appropriate. Thanks for commenting 🙂

  2. 23 February 2013 at 10:55 am

    You get email everytime you lose connection not every minute. I will dig and find the exact script i created….

  3. Tdudus
    10 March 2013 at 10:09 pm

    Try “nmap -sP 192.168.254.0/24”.
    It tells all IP adresses on your network, and tries to guess manufacturer from MAC address.

Leave a Reply

Your email address will not be published. Required fields are marked *