Categories
Code Raspberry Pi

How to find a Raspberry Pi on your network

Here’s a quick tip to finding a Raspberry Pi (and anything else) on your network using the nmap network scanning security tool.

Quite often you might want to run a ‘headless’ Raspberry Pi without a screen or keyboard, using SSH to connect. SSH can be enabled in the config menu when you first boot the Pi. You can then find the IP address of your Pi when you’re initially setting it up using the ifconfig command in the terminal. Normally this works like this – on the Pi you want to connect to, type into the terminal:

ifconfig

Note the value next to “inet addr” – which usually looks like 192.168.1.(a number) – Then from another machine you can SSH to your Pi to allow for remote control

ssh pi@[the ip address of your pi]

This is fine, but most home networks use something called DHCP – ‘dynamic host configuration protocol’ – local IP addresses are temporarily assigned to the computers by your router (the DHCP server). Although these addresses often don’t change, they can. You can assign a static IP address which is something i’ve used in the past, or install a service like no-ip that tracks your Pi’s IP address (and makes it available over the internet as well). You also need to be able to connect a screen to the computer you’re attempting to connect to!

A simpler method is to use a tool called nmap (network map)- there are versions available for windows and mac, and it works from a Raspberry Pi. It’s also free.

For instance, you might have a Raspberry Pi setup on your network with a monitor and keyboard, and you’ve plugged a second Pi in that’s running SSH.

Install nmap with:

sudo apt-get install nmap

and then use the following command:

sudo nmap -sP 192.168.1.*

Returns a list of ips and hostnames – just look for the one called Raspberry Pi – This takes about 30 seconds.

Just like the matrix
Just like the matrix

Nmap does a lot of other things as well – and it’s the program of choice whenever movies attempt to depict computer hacking, or if you want to hack into Matt Damon’s brain.

If you’re looking for a more portable version there’s a (paid for) tool called Scany which is available for the iPhone and iPad or Fing which is free.

 

 

5 replies on “How to find a Raspberry Pi on your network”

Thank you – I didn’t know about that one. I like the way you can SSH directly in the tool as well.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.