Scan for Computers on Local Network with Nmap

Support this website by purchasing prints of my photographs! Check them out here.

With my Raspberry Pi project, it has been using DHCP to get an IP address, and my network keeps assigning a different value (I know there are solutions to this but I haven't made use of them yet). So, I went ahead and installed nmap using the homebrew package manager for OS X:

$ brew install nmap

And now, I can scan the local network to see what devices are up:

$ sudo nmap -sP 192.168.1.1-254

Starting Nmap 6.00 ( http://nmap.org ) at 2012-06-10 10:12 EDT
Nmap scan report for 192.168.1.1
Host is up (0.0041s latency).
MAC Address: B8:8D:12:5A:00:00 (Apple)
Nmap scan report for 192.168.1.2
Host is up (0.0039s latency).
MAC Address: E8:E0:B7:17:00:00 (Toshiba)
Nmap scan report for 192.168.1.6
Host is up (0.32s latency).
MAC Address: B8:27:EB:4C:00:00 (Raspberry Pi Foundation)
Nmap done: 254 IP addresses (3 hosts up) scanned in 5.46 second

The better solution would be to have the device use a static IP address (or even cooler, add a tiny LCD screen to show the current IP address :D).

Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript and is an O'Reilly published author.