Boot Raspberry Pi with wifi on first boot


You got your Raspberry Pi, but you don’t have a keyboard and/or a monitor, and you want to connect the Rapsberry Pi via wifi network (a.k.a. ‘headless’) on the first boot. so how to configure your SD Card to boot up the Raspberry Pi with wifi-only?

With the Raspberry Pi zero (and zero W) gaining popularity, I found myself helping to answer this kind of questions again and again on Raspberry Pi Stack Exchange, there are tons of tutorials on the Internet teach you how to setup a headless connection AFTER you connecting to the Raspberry Pi via ethernet with a keyboard and a monitor on the first boot to configure the system. However, it is not a lot of well-documented on how to create an SD card to boot up with only wi-fi and remote ssh access. So I summarised my various answers on the Stack Exchange and share with this post.

I will skip the creation of an SD card image as the information is readily available on Raspberry Pi official website.

Step 1 – Enable SSH on boot

By default, SSH access is disabled for security reason as many user often forgot to disabled it when using Raspberry Pi as a web server. We will need to enable the SSH when Raspberry Pi is booted up for the first time. To do that, create a file called ssh (with no file extension) and copy it to the SD card. The content of the file doesn’t matter.

Step 2 – Add wifi configuration

Create a file name wpa_supplicant.conf and copy it to SD card, the content of wpa_supplicant.conf looks like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Replace wifi_ssid and wifi_password with your actual wifi network information. The wpa_supplicant.conf file will get copy to /etc/wpa_supplicant/ directory automatically once the Raspberry Pi is booted up.

Step 3 – Identify the Raspberry Pi IP address

Put the SD card into the Raspberry Pi and boot it up, wait for a couple of minutes and run linux command arp -a form your desktop or notebook computer that is connected on the same network. The command will provide a list of IP addressed that is connected to the network. If the Raspberry Pi has a build-in wifi, it is easy to spot the IP address by looking at MAC address as Raspberry pi MAC address always started as b8:28:xx:xx:xx:xx. If you are using a wifi dongle, the MAC address varies, you can compare the lists before and after running the linux command to identify IP address belong to the Raspberry Pi.

Step 4 РLogin via SSH

Run terminal command from your computer to login to Raspberry Pi like this:

ssh pi@

Replace with the IP address that you identified in step 3.

That’s all. You have successfully boot up your Raspberry Pi at first boot with wifi only, no keyboard, no monitor, and no¬†ethernet cable required.

One commment by reader

  1. Thanks for this guide, there’s a missing “}” from the wpa_supplicant.conf file that had me stumped for quite a while.


Leave a Reply

Your email address will not be published. Required fields are marked *