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)
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….
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 🙂
I created a cron job that checks internet connectivity every minute and every time raspi was reconnected on internet was sending email check this out:
http://www.linuxscrew.com/2009/04/02/tiny-bash-scripts-check-internet-connection-availability/
Not a bad idea. Doesn’t that mean rather a lot of emails?
You get email everytime you lose connection not every minute. I will dig and find the exact script i created….
[…] recantha I was at work running a Pi headless… And I realised I had no way of knowing what the IP address […]
Try “nmap -sP 192.168.254.0/24”.
It tells all IP adresses on your network, and tries to guess manufacturer from MAC address.