Find the IP address of a headless RPi

Recently, I found myself with a headless RPi in a public workspace. I could do a fresh install of the OS (64 bit Bullseye, the full version), and I had been able to pre-configure the WiFi credentials for the site. But once it had booted, I had no idea of it’s IP address.

I had already established that the IP address allocated to my PC was 10.0.65.180, so I guessed / hoped that the RPi would have a similar address.

I ran the following command (from a WSL command line) and found the answer…

sudo nmap -p 22 -sS 10.0.65.180-190

This scans the network in the address range 10.0.65.180 to 10.0.65.190 looking for devices with port 22 (that used by SSH) open. The command takes a while (about 20 seconds in this case), but you get a list of the address which have the port open. It’s then just a case of trying to log into each until you find one that accepts the connection.