For headless setup using Wifi, follow: https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
An example wpa_supplicant.conf
file can be found here, as well as other ways to find the IP address of the RPi (nmap
, Apple's Bonjour): https://blog.erratasec.com/2018/08/provisioning-headless-raspberry-pi.html#.XNeVuKQpAaF
The command wpa_passphrase
can be used to generate a hash of your Wifi network's security key, instead of store it in plaintext in the wpa_supplicant.conf
file.
To initially find the IP address of the RPi, I logged into my home router's admin console to find the DHCP-assigned IP address. After doing that I could ssh pi@<ip address>
and add the following unit for later use:
utra-say-ip.service
(copy it to /etc/systemd/system/utra-say-ip.service
):
[Unit]
Description=Say the host IP address out through speaker
Before=systemd-user-sessions.service
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/home/pi/say_ip_address
[Install]
WantedBy=multi-user.target
And the say_ip_address
script (at /home/pi/say_ip_address
):
#!/bin/bash
for i in {1..5}
do
hostname -I | festival --tts
sleep 1
done
Once the scripts are in place, do:
sudo apt install festival
chmod +x /home/pi/say_ip_address
sudo systemctl enable utra-say-ip
Then, doing systemctl reboot
, the RPi should announce its Wifi IP address through the audo jack when you have speakers or headphones connected. You can then SSH into the Pi using that address.
Note the Pi is only configured to connect to the networks you specified in wpa_supplicant.conf
.
This method is based on: https://www.instructables.com/id/How-a-headless-Raspberry-Pi-can-tell-you-its-IP-ad/
Another interesting gist to provision the Pi (ideally we wouldn't have to add in the above unit and script and enable it manually - this would be done at install time): https://gist.github.com/RichardBronosky/fa7d4db13bab3fbb8d9e0fff7ea88aa2
To find pi IP address by scanning network:
(https://raspberrypi.stackexchange.com/questions/13936/find-raspberry-pi-address-on-local-network)