Planning on running your Raspberry PI as a server on your local network? Excellent idea. They’re cheap, powerful and require little power. The perfect solution for a basic file-, web- or game-server. In order to access the Raspberry PI server from another device on your local network, you need to know its IP address. This article presents several methods on how to find the IP address of your Raspberry PI.
During the boot process, your Raspberry PI requests an IP address from your router. The Dynamic Host Configuration Protocol (DHCP) server running on your router, handles the request and assigns an IP address to your Raspberry PI. The IP address uniquely identifies the Raspberry PI device on your local network. Routers on your local network typically assign an IPv4 address. This is a dot-separated number consisting of four 8-bit values, also known as the dotted-decimal notation. For example:
If you run your Raspberry PI as a desktop machine, chances are that you never even need to know about its IP address. Things change though, the moment you run your Raspberry PI as a server. Being able to remotely access your Raspberry PI is the entire point of it being a server. This is where the IP address comes into play. You can think of its assigned IP address as a phone number, which other network devices use for accessing it.
In the use case of a server, it is therefore important that you know how to find the IP address of your Raspberry PI. This article explains several methods of retrieving the IP address of your Raspberry PI.
What do you need
For this article you need a Raspberry PI with the Raspberry PI operating system installed, and connected to your local network. Either directly with an Ethernet cable or wireless via WiFi.
For this article I’ll use my Raspberry PI 2 connected to my home’s WiFi network. Unlike the Raspberry PI 3, 4, and Zero W, the Raspberry PI 2 does not feature an on-board WiFi adapter. For this reason, I inserted a USB WiFi adapter into one of its four USB slots.
In case you did not yet install the Raspberry PI operating system, consider following the steps outlined in this article:
Find your Raspberry PI’s IP address using the terminal
Two entities on your local network know about your Raspberry PI’s IP address:
- The Raspberry PI itself.
- Your network router, which assigned it.
The Raspberry PI itself therefore makes a good starting point for finding the IP address. However, in the case of a headless server, you probably did not connect a keyboard and display to it. This leaves you with two options:
- Remotely log in to it via SSH
- Temporarily connect a keyboard and display.
The first option won’t work, because you already need the IP address to remotely connect to it via SSH. The good ol’ chicken and egg problem. This leaves the option of temporarily connecting a keyboard and display to your Raspberry PI, just for the purpose of obtaining the IP address.
Once you locally logged into your server, you can find its IP address by running command:
Alternatively, you can list details of all the network interfaces, including the assigned IP addresses, with:
You’ll have to sift through the output a bit to locate the IP address, but it’s definitely there:
Find your Raspberry PI’s IP address using your router
If connecting a keyboard and display to your Raspberry PI is not a viable option, or if you just don’t want to deal with the hassle, you can also log into the web interface of your network router. Through the web interface, you can usually find a list with all connected devices and their assigned IP addresses. How exactly this works, differs per network router type.
Here’s a screenshot of where I found the IP address of my Raspberry PI, through the web interface of my Fritz!Box 7490 network router:
Find your Raspberry PI’s IP address with the help of nmap
In case the previously presented two methods did not work out for you, a third option exists: You can run the
nmap utility on another Linux PC, assuming that you connected this PC to the same local network as your Raspberry PI. The
nmap utility is a network exploration tool. With it, you can scan and retrieve the IP addresses of all devices on the local network.
Installing the nmap utility
Not all Linux distributions install the
nmap utility by default. As a prerequisite to applying this method for finding the IP address of your Raspberry PI, we should first install the
nmap utility. Installation instructions for popular Linux distributions:
- Debian/Ubuntu/Raspberry PI:
sudo apt install nmap
sudo dnf install nmap
sudo zypper install nmap
Scanning the local network with the nmap utility
nmap utility can scan all devices on your local network. In essence, it pings all possible IP addresses on the same subnet that your Linux PC is connected to. We can derive the subnet of the local network, by inspecting the IP address of our Linux PC (not the Raspberry PI…duh). Open a terminal on your Linux PC and obtain its IP address using either command
hostname -I or
ip addr, as previously presented. On my openSUSE Tumbleweed machine, this results in:
Remove the number after the last dot to obtain the subnet. My local network’s subnet:
nmap command syntax to scan this entire subnet for available devices:
sudo nmap -sn [SUBNET].0/24
[SUBNET] with the one of your local network. In my case:
sudo nmap -sn 192.168.178.0/24
nmap sends a ping command to each IP address on the subnet. This is range
192.168.178.255 on my local network. The output lists information about the devices that responded. So it won’t just show you the IP address of just your Raspberry PI, but the IP address of all devices on your local network. With a bit of searching through
nmap‘s command output, you can find the IP address of your Raspberry PI. Example taken from running
nmap on my openSUSE Tumbleweed PC:
Remotely connect to your Raspberry PI via SSH
The previous sections presented three methods for finding the IP address of your Raspberry PI. All three methods yielded the same result for the IP address of my Raspberry PI:
To verify its correctness, you can attempt to remotely log in to your Raspberry PI via SSH. The syntax of the command to run from your Linux PC for this:
ssh [USERNAME]@[IP ADDRESS]
Example for connecting to the Raspberry PI on my local network:
When running your Raspberry PI as a server on your local network, sooner or later you’ll need to know its assigned IP address. This article presented three methods of finding the IP address of your Raspberry PI:
- Connect a keyboard and display and run the
ip addrcommand directly on the Raspberry PI.
- Log in to your router’s web interface and locate the list with active network devices.
- Use another PC to scan all devices on your local network with the help of the
All solutions work and the best one depends on your personal preference. Myself, I gravitate towards using my router’s web interface. If that doesn’t work, I fall back to the
nmap option. Simply because I don’t always feel like going through the effort of connecting a keyboard and display to the Raspberry PI.
If you run your Raspberry PI as a server on your local network, skim through these articles as well for improving the security your Raspberry PI: