Configuring Network Access

Last updated 2 months ago

Step 1: Setup Wi-Fi credentials

If your device is connected via an Ethernet cable, you can skip this step.

Insert the SD card in your computer and create a file named wpa_supplicant.conf at the root of the boot volume of the SD card. Paste the following snippet:

country=<COUNTRY_CODE>
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Your Wi-Fi network name"
psk="Your Wi-Fi network password"
}

Make sure to update the country, ssid and psk keys.

Step 2: Enable SSH access

Enable SSH access by adding an empty file ssh, again placed at the root of the boot volume on your SD card.

Step 3: Log in to your device

Insert the SD card into the Raspberry Pi. It will boot in roughly 20 seconds. You should now have SSH access to your Raspberry Pi. By default, its hostname will be raspberrypi.local.

On your computer, open a terminal window and type the following:

ssh pi@raspberrypi.local

The default password is raspberry. You should be greeted with a welcome message and an active prompt on the Raspberry Pi.

Step 4: Update the hostname (optional)

Optionally, you may change the hostname of your Raspberry Pi to something more descriptive (instead of raspberrypi, it could be raspi-kitchen), and to avoid conflicts if you have other devices on your network with the same hostname. To do so, run the following command from your SSH session:

sudo raspi-config

Select 2 Network Options > N1 Hostname, enter a new hostname, save and reboot:

sudo reboot

This will also close your SSH session. Wait approximately 20 seconds for the device to reboot, then reconnect via SSH, but this time, using the new hostname (here, raspi-kitchen):

ssh pi@raspi-kitchen.local