If you have trouble finding the ip address of your Raspberry Pi connected to your local LAN, here is how to find it.
All the Raspberry Pi have a MAC address that starts with predefined values attributed to the device's vendor. For a Raspberry Pi these values can be :
28:CD:C1
2C:CF:67
3A:35:41
D8:3A:DD
DC:A6:32
E4:5F:01
B8:27:EB
Source :
- https://maclookup.app/vendors/raspberry-pi-trading-ltd
- https://maclookup.app/vendors/raspberry-pi-foundation
We can use these values to detect the Raspberry Pi devices in a LAN.
Scan the network for all the connected devices that have a MAC address starting with any of these values :
$ sudo nmap -sn 192.168.1.0/24 | egrep -iB2 "(D8:3A:DD)|(B8:27:EB)|(28:CD:C1)|(2C:CF:67)|(3A:35:41)|(DC:A6:32)|(E4:5F:01)"
Nmap scan report for 192.168.1.123
Host is up (0.073s latency).
MAC Address: D8:3A:DD:3F:38:B1 (Unknown)
A RPi has been found with IP 192.168.1.123 :
ssh username@192.168.1.123
Note : in the example above, replace 192.168.1.0/24 by your local LAN subnet. The most common subnets are :
192.168.0.0/24: commonly used by many consumer-grade routers as the default LAN subnet.192.168.1.0/24: another popular default subnet for many routers.10.0.0.0/24: often used by some routers and larger networks for more flexibility in subnetting.172.16.0.0/16and172.16.0.0/24: used in some larger corporate or enterprise networks.
Create a bash script :
#!/bin/bash
if [ -z "$SUDO_USER" ]; then
echo "This script must be run with sudo or as root."
exit 1
fi
echo "Please wait..."
sudo nmap -sn 192.168.1.0/24 | egrep -iB2 "(D8:3A:DD)|(B8:27:EB)|(28:CD:C1)|(2C:CF:67)|(3A:35:41)|(DC:A6:32)|(E4:5F:01)"