# 1. Installation of the needed package
apt-get install wpasupplicant
# 2. modify the file wpa_supplicant.conf (create if not exist in /etc/wpa_supplicant)
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="ssid_of_the_network"
key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
psk="my passphrase"
}
# if you want an other network
network={
ssid="ssid_of_an_other_network"
key_mgmt=NONE
}
# 3. modify /etc/network/interfaces
auto myinterface
iface myinterface inet dhcp
wpa-drivers wext # you can get the list of drivers with the command wpa_supplicant
wpa-conf /path_of_wpa_supplicant.conf
# 4. We can run
ifdown myinterface && ifup myinterface