Finding Your Headless DHCP’d RasPi using nmap

I like as few cables as possible. And besides, many of my spare monitors don’t have an HDMI connector. So when I’m hooking up a raspi for the first time, my preferred method is to just attach ethernet and power and use nmap.

Now, if you are lucky you *might* be able to just do a ping raspberrypi, or raspberrypi.local But this depends on your DHCP server. This worked for me at the windows 7 cmd prompt, at least.

Nmap probes networks and it runs on just about any platform you can download from here

Exactly how you invoke nmap will vary from platform to platform, but here is how you would do it under the windows command prompt.

C:\"Program Files (x86)"\Nmap\nmap.exe -sP 10.0.0.1-255

You will also need to change your IP address range (10.0.0.1-255), to your IP address range (more commonly: 192.168.0.1-255 or 192.168.1.1-255)

Nmap scan report for raspberrypi.home (10.0.0.40)
Host is up (0.0020s latency).
MAC Address: B8:27:EB:28:97:88 (Raspberry Pi Foundation)

If you want it to just print out the address without having to search the listing you could add this on the end:

nmap -sP 10.0.0.1-255 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'

And there you have it. My raspi is at 10.0.0.49, I can now ssh to that address using putty, for instance.

More info on here: http://raspberrypi.stackexchange.com/questions/12440/ssh-into-raspberry-pi-without-knowing-ip-address