Finding a device on your network is an important task. It is wise to keep an eye on what machines are on your network, and what they are doing.
Also knowing the hostname or IP address of a machine means we can remotely connect to it, for example via SSH. If, for example, you have a Raspberry Pi hooked up but can’t remember its name, scanning the network will give you that information.
In this how-to, we will learn the various means to scan your home network and find the machines which are on it. To illustrate the task we’re going to search for a Raspberry Pi running the latest version of Raspberry Pi OS.
Finding Network Devices Via Your Router
Each router is a little different, but most will offer a means to show all of the devices on your network. To see this, you will need to login to your router and navigate the options searching for “Devices”. Here we can see the Device Name (hostname) and the IP Address of machines on our network.
Scan for Network Devices in Linux and MacOS
Linux users can use nmap, a network scanning tool to search for all the devices on their home network and then display their open ports. Here we are using an Ubuntu 22.04 install.
1. Open a terminal and update the list of software repositories.
sudo apt update
2. Install nmap using the apt package manager.
sudo apt install nmap
3. Using sudo, invoke the nmap command with the -Pn argument to scan all IP addresses on your network. Our network uses the IP range 192.168.0.0 to 192.168.0.255, your network may not. Adjust the IP address range to match your network.
sudo nmap -Pn 192.168.0.0/24
4. Scroll through the returned results to find the device that you wish to SSH into. Our target was a Raspberry Pi, and we can see two IP addresses that match. Both of these are the same machine, connected via Wi-Fi and Ethernet.
Read more: How To Scan For Devices on Your Network