You just got your 2nd Raspberry Pi for Christmas, you want to set it up but you don't have a spare monitor to perform its first-boot configuration. Fear not, the solution is here.

Enable SSH via /boot/

When you write the Raspbian image to the SDCard, a /boot/ FAT32 partition is created which is accessible both on Windows and Linux.

To enable the SSH service, simply create a file called “ssh” without an extention like:

/boot/ssh

Figuring out the IP Address

Now we know the SSH service will be started when RPi starts, but how do we know its IP address if it's dynamically allocated? The arp-scan utility comes in handly here.

First, make sure it's installed:

sudo apt install arp-scan

Before Powering On

Run:

sudo arp-scan --localnet > /tmp/scan-before.txt

This command will scan all your local network and display all IP/MAC addresses identified:

Interface: wlp2s0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.0.1     XX:XX:XX:XX:XX:XX       (Unknown)
192.168.0.2     XX:XX:XX:XX:XX:XX       (Unknown)
192.168.0.100   XX:XX:XX:XX:XX:XX       (Unknown)
192.168.0.101   XX:XX:XX:XX:XX:XX       (Unknown)
192.168.0.201   XX:XX:XX:XX:XX:XX       (Unknown)
192.168.0.50    XX:XX:XX:XX:XX:XX       (Unknown)

6 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8.1: 256 hosts scanned in 1.837 seconds (139.36 hosts/sec). 6 responded

After Powering On

Turn on your RPi, wait a couple of minutes and run the same command but to a different output file:

sudo arp-scan --localnet > /tmp/scan-after.txt

Now we have the “before” and “after”.

Finding out the IP

Run a simple diff:

diff /tmp/scan-before.txt /tmp/scan-after.txt

From the output you will be able to determine which one is the new IP address.