How to Find IP Address of Your Raspberry Pi
This article will introduce several methods to find the IP address of your Raspberry Pi.
Display IP Address Using ip
on Raspberry Pi OS
Generally, the solution for finding the IP address of your Raspberry Pi depends on the type of access you have to the system itself. Namely, if you are locally connected to the Pi, you can just run the ip
command to display your network configuration details, including the local IP address.
On the other hand, if you don’t have console access or even remote access to the system, you’d need to utilize some network scanning software.
The ip
command can be used to display and manipulate network interfaces, routing, and other related details. It’s usually included in Raspberry Pi OS and many Linux distributions, so you can open a CLI interface and run the following command.
It will display the output below, where all available interface names and configurations are listed. In this case, we assume to be interested in finding the IP address of the Ethernet interface.
So, we should look for the eth0
name and corresponding inet
address (e.g., 192.168.0.12
). Note that the inet
keyword is associated with the IPv4 address, but you can also find the IPv6 address across the inet6
keyword.
ip a
Sample Output:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
---
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:e2:52:1c brd ff:ff:ff:ff:ff:ff
inet 192.168.0.12/24 brd 192.168.0.255 scope global
---
Retrieve IP Address Using ifconfig
on Raspberry Pi OS
Another useful CLI utility is ifconfig
, which is usually preinstalled on Raspberry Pi OS. ifconfig
similar to the ip
command utilizes special names like eth0
, lo
, wlan0
. To display different network interface types. eth
prefixed names usually denote Ethernet interfaces, and wlan
is used for wireless ones.
The output is somewhat similar to the ip
command, but you can still find inet
and inet6
keywords before IPv4/IPv6 addresses, respectively.
ifconfig
Sample Output:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.12 netmask 255.255.255.0 broadcast 172.16.0.255
inet6 fe80::7df4:d6b9:171:f302 prefixlen 64 scopeid
---
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
---
Find IP Address Using nmap
Network Exploration Tool
This method is usually for those users who do not have console access to the Raspberry Pi itself. Still, they have access to some Linux systems located in the same local network as the Pi.
nmap
is an open-source tool for network scanning that can use in many aspects of network administration or security auditing. Note that you’d need to install nmap
on your Linux system, and some version of it is usually available from most distro repositories.
At first, you need to find out or know the local address range of your network. In this case, we assume that you will be running nmap
on a home/small-office autoconfigured network, where both the Linux system and Raspberry Pi are connected to the same router
.
The assumed local address range will be 192.168.0.0/24 in the following examples. Once you have nmap
installed, open the console and run the following command:
sudo nmap -O 192.168.0.0/24
Consequently, nmap
will scan the whole subnet and each online device. However, device detection may fail if the target, in this case, Raspberry Pi, is running a firewall and blocking almost all incoming network packets.
The above command runs with the sudo
prefix because it’s necessary for target operating system detection. The latter can be helpful to identify Raspberry Pi devices on the network directly.
The output is given in human-friendly format, and you can locate each host who successfully scanned with corresponding IP addresses.
Founder of DelftStack.com. Jinku has worked in the robotics and automotive industries for over 8 years. He sharpened his coding skills when he needed to do the automatic testing, data collection from remote servers and report creation from the endurance test. He is from an electrical/electronics engineering background but has expanded his interest to embedded electronics, embedded programming and front-/back-end programming.
LinkedIn FacebookRelated Article - Raspberry Pi
- How to Setup a Raspberry Pi File Server
- How to Setup MySQL in Raspberry Pi
- DNS Server on Raspberry Pi
- How to Use Dropbox on Raspberry Pi
- How to Use Plex Media Player on Raspberry Pi
- Chromium OS on Raspberry Pi