How To Setup A Protected Wireless Connection Via the Command-Line
Setting up a wireless connection via the command line may vary depending on the USB Wireless Interface you are using. These instructions also work for the Raspberry PI running Wheezy. You must be root in order to carry out these instructions.
Make sure that your wireless interface is recognized.
Find your wireless interface name (usually wlan0).
Make sure that your network is visible asssuming the ESSID is broadcasted. Replace wlan0 by you wireless interface name.
iwlist wlan0 scan
iwlist wlan0 scan | grep ESSID
Prepare your wireless configuration file. It will wait for you to type in your wireless network password. Enter your wireless network password an hit ENTER.
wpa_passphrase Replace-with-your-ESSID > wpa.conf
Find out which wireless driver you are using. The drivers are listed in the drivers section. The driver you are using is usually labelled “Linux wireless extensions”. The driver name is most of the time wext.
Initialize the wireless interface. Make sure you replace wpa.conf, wext and wlan0 with the values related to your environment. Some error messages may be displayed. These errors might not prevent your wireless connection from working.
wpa_supplicant -Dwext -iwlan0 -cwpa.conf -B
You can check if your wireless interface is properly initialized.
Issue this command to get an IP address assuming you are using DHCP.
You can install wpa_passphrase and wpa_supplicant is they are not already on your system by issuing the command
apt-get install wpasupplicant