Run lsusb and make sure the dongle is registered.
Bus 001 Device 005: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Create /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
# WPA network
network={
ssid="fishred"
psk="thepassphrase"
priority=1
}
# WPA network
network={
ssid="fishblue"
psk="thepassphrase"
priority=1
}
Edit /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
#
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
#
# Example to keep MAC address between reboots
#hwaddress ether DE:AD:BE:EF:CA:FE
#
# The secondary network interface
#allow-hotplug eth1
#iface eth1 inet dhcp
#
# WiFi Example
auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#
#auto wlan0
#iface wlan0 inet dhcp
# wpa-ssid "fishred"
# wpa-psk "wpapass"
#
#auto wlan0
#iface wlan0 inet static
# wpa-ssid "fishred"
# wpa-psk "wpapass"
# address 192.168.83.44
# netmask 255.255.255.0
# gateway 192.168.83.1
#
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
# Note on some boards, usb0 is automaticly setup with an init script
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1