How to find your Raspberry Pi's IP address

How to find your Raspberry Pi's IP address

This short guide shows you various ways to find the IP address of your Raspberry Pi.

1

Using an ethernet cable or WiFi, connect your Raspberry Pi to your local network. Make sure the device is powered on.

2

Open a shell on Unix systems, or open the Command Prompt on Windows and run the following command:

ping raspi

This should ping your Raspberry Pi and return its IP address. If you see an error similar to cannot resolve raspi: Unknown host, try running the following instead:

ping raspberrypi

If you're having problems with this, or if you have multiple Raspberry Pi's on the same network move on to the next step.

3

We can use nmap to scan our local network to find all devices that are connected. To do this we'll have to find the IP address of our local computer.

macOS

On a Mac, open the Network Utility (cmd + space, then search for Network Utility).

Windows

On Windows, open the Network and Sharing Center (Control Panel > Network and Sharing Center > View network connections).

Linux

And on linux, type hostname -I in a shell.

You're IP address will likely be something like: 192.168.1.181. So other devices on the same network are going to have addresses that share the first three octets: 192.168.1. The notation to describe the entire range of IP addresses between 192.168.1.0 and 192.168.1.255 is 192.168.1.0/24.

Once we determine the subnet range, we'll use it with the nmap command:

nmap -sn 192.168.1.0/24

If you're running on a unix system, you might be required to run this command using sudo:

sudo nmap -sn 192.168.1.0/24

You'll then see a list of devices connected to the network:

Nmap scan report for Chromecast.attlocal.net (192.168.1.78)
Host is up (0.042s latency).
MAC Address: 54:60:09:06:76:0A (Google)
Nmap scan report for unknownc24b2b235d18.attlocal.net (192.168.1.178)
Host is up (0.038s latency).
MAC Address: C2:4B:2B:23:5D:18 (Unknown)
Nmap scan report for docker1.attlocal.net (192.168.1.181)
Host is up (0.51s latency).
MAC Address: B8:27:EB:79:49:F2 (Raspberry Pi Foundation)
Nmap scan report for raspberrypi.attlocal.net (192.168.1.183)
Host is up (0.51s latency).
MAC Address: B8:27:EB:95:6D:7A (Raspberry Pi Foundation)

You'll notice here that I have a few devices, but after a quick scan you'll notice a few Raspberry Pi's connected to the network. From here you can discover the IP address for each Pi.