Pi Zero W - prepare wireless connection

RaspberryPi OS

This will likely work with most systemd based Linux distribution using systemd-networkd

Watch out for

  • verify interface
  • with desktop dhcp will do
  • headless

Prepare the SD card using RPI imager - mount the resulting root partition on the SD card.

Raspberry Pi Documentation

Edit the file as root

$MOUNTPOINT/etc/wpa_supplicant/wpa_supplicant.conf

Append the following and save the file

  ....

network={
    ssid="apname"
    psk="pskvalue or cleartext passphrase"
}

Edit the file as root

$MOUNTPOINT/etc/network/interfaces

Append the following and save the file

  ....

allow-hotplug wlan0

iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Source Raspberry Pi wpa_cli