Simple Wifi Configuration for Raspberry Pi /etc/network/interfaces

Sometimes, when I’m troubleshooting or initially setting up a Raspberry Pi,  I like to create a dead simple configuration to connect to my home wifi network. This skips using the wpa_supplicant and has all the information in the intitial networking file for simplicity.

From the command line on your Pi I do the following:

  1. cd /etc/network
  2. sudo cp interfaces interfaces-wifi

    This makes a copy of our existing interfaces file for a backup.

  3. sudo nano /etc/network/interfaces

    We open the file in a text editor to make our changes.

Update the code in this file so that it contains the code following this paragraph:
Be sure to insert the name of your network in place of ssid inside the quotes as the value for wpa-ssid and password in the appropriate place as the value for wpa-psk, within the code. You may already some of these lines in there for your ethernet (eth0) so you can keep it or replace it.

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "ssid"
wpa-psk "password"

After your file looks like this, hit Ctrl-X, then y for yes and enter.
I usually reboot at this point with a command of:

sudo reboot

Note: If something happens and you can’t log onto your wifi network, don’t despair. Just hook up your monitor and keyboard and go back to this file, change it back or rename your backup file to interfaces and you are back where you started. To change back to your original interfaces file that we renamed in step #2, just type this on the command line.

sudo cp /etc/network/intefaces-wifi /etc/network/interfaces

When finished doing this, reboot again.

sudo reboot

Leave a Reply