Set up Wifi with WPA2-PSK and DHCP on a RaspberryPi

Setting up your Wifi on your RaspberryPi via the command line is quite is. Just fire up your terminal, SSH into your Pi and do the following:

  1. Plug in your Wifi device and become the superuser:
    sudo -i
  2. Edit your interfaces file:
    nano /etc/network/interfaces
  3. Uncomment everything below allow-hotplug wlan0
  4. Add
    iface wlan0 inet dhcp wpa-ssid <YOUR SSID> wpa-psk <YOUR PASSPHRASE/KEY>
  5. Now restart your RaspberryPi:
    shutdown -r now
    The Wifi will come up on it's own.

All in all your /etc/network/interfaces now probably looks like this:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
# iface wlan0 inet manual
# wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
# iface default inet dhcp

iface wlan0 inet dhcp
wpa-ssid <YOUR SSID>
wpa-psk <YOUR PASSPHRASE/KEY>

Source:
- HOW TO INSTALL THE EDIMAX EW-7811UN WIFI ADAPTER ON THE RASPBERRY PI

The author

Written by Per

Free software enthusiast and transhumanist residing in Stuttgart, Germany.


comments powered by Disqus