Skip to lesson content

Raspberry Pi Setup · Lesson 5 of 17

Set up Wi-Fi on Raspberry Pi OS Lite

To get a new Pi online without a screen, save the Wi-Fi details in Raspberry Pi Imager. If the Pi is already running, you can join a home network or phone hotspot from its terminal.

Connect on first boot with Imager

  1. On your computer, open Raspberry Pi Imager. Select your Pi model, Raspberry Pi OS Lite and the microSD card you intend to erase.
  2. In OS customisation, set a hostname, your username and your sign-in details. Choose your location and enter the Wi-Fi network name (SSID) and password. Enable SSH under remote access if you plan to use the Pi without a monitor.
  3. Write the image, insert the card into the Pi and power it on within range of the network. From a computer on the same network, sign in with ssh [email protected], substituting the username and hostname you chose. If the name does not resolve, find the Pi in the router's connected devices and use its IP address.

From Raspberry Pi OS Bookworm onward, the operating system uses NetworkManager by default and no longer imports wpa_supplicant.conf from the boot partition.

Join a network from the terminal

Use a keyboard and monitor or an SSH session over Ethernet. Changing the network that carries your SSH session can disconnect you. These commands are for a personal Wi-Fi network and a Pi running NetworkManager.

  1. Run systemctl is-active NetworkManager. If it says active, run sudo raspi-config and select your country under Localisation Options → WLAN Country if you have not set it yet.
  2. Turn on Wi-Fi and find your network in the SSID column.
    sudo nmcli radio wifi on
    nmcli device wifi list --rescan yes
  3. Type the network name exactly as it appears in the scan, including any spaces or punctuation. Enter the Wi-Fi password when prompted.
    sudo nmcli --ask device wifi connect

Check the connection

nmcli device wifi list
nmcli device status
ip -brief address

Look for a star in the IN-USE column beside your SSID. Find the Wi-Fi device marked connected and match its name to the IP address list. An address on that interface shows the Pi can participate in the local network.

  • Network missing? Check the wireless country and run the scan again. A Pi Zero 2 W needs a 2.4 GHz network. For a hidden SSID, supply the name explicitly, for example sudo nmcli --ask device wifi connect 'My Network' hidden yes.
  • Password rejected? Check the network name and re-enter its Wi-Fi password when prompted. A campus or workplace network that requires a username or certificate needs the settings supplied by its administrator.
  • Older installation? If NetworkManager is inactive on a Bullseye or earlier installation that uses dhcpcd and wpa_supplicant, use the legacy Wi-Fi instructions.

To decide which saved network the Pi joins at boot, follow Auto-connect a Raspberry Pi to a Wi-Fi hotspot.

Documentation