/ raspberry

Connect a raspberry to a wifi

How to connect a raspberry to a wifi?

The settings are done to use dhcp with WPA2 security settings.
First edit the network interfaces:
$sudo nano /etc/network/interfaces

Insert or edit the file to contain the following:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

To get a list of available Wifi networks try the command sudo iwlist scan | grep ESSID

Edit the wpa_supplicant file to configure the network settings to use WPA2:
$sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

network={
    ssid="<network-name>"
    psk="<network-passwd>"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
}