Configure Raspian WiFi network

1. Configuring your WiFi network for raspbian using wpa_supplicant

This is the default /etc/network/interfaces file as supplied in the raspbian image:

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

To enable auto-loginsudo nano /etc/wpa_supplicant/wpa_supplicant.conf

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

network={
    ssid="Your-Network-Name"
    psk="Your-Network-Password"
    }

To add additional networks
Add network={.....} sections defining different networks if you carry your Pi around with you. This will allow you to connect to these other networks at various different locations without needing to change your setup.

2. Configuring your wifi network for raspbian without using wpa_supplicant

Networks using WPA/WPA2 securitysudo nano /etc/network/interfaces

auto lo iface

lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "Your-Network-Name"
wpa-psk "Your-Network-Password"

Networks using WEP securitysudo nano /etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid Your-Network-Name
wireless-key Your-Network-Password

Do not use quotation marks around

  • Your-Network-Name
  • Your-Network-Password — if converted to passkey format

Use quotation marks around

  • Your-Network-Password — if in plain text

Networks using no securitysudo nano /etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid Your-Network-Name

Do not use quotation marks around

  • Your-Network-Name

 


Source: http://www.fars-robotics.net/