Setup wireless with command lines

My ubuntu box does not always configure wireless connection correctly. Luckily, setting connection on command line is rather easy. I followed the comment by Savage for this guide (or I guess this one is kind of the same).

It didn’t work the first shot for me. But it worked after some slight modifications. You may have a different device, but wlan0 worked for me. Please change myssid and mypassphrase to your ssid and passphrase also.

sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode Managed
sudo ifconfig wlan0 up
sudo killall wpa_supplicant
wpa_passphrase myssid mypassphrase > wireless-wpa.conf
sudo wpa_supplicant -B -Dwext -i wlan0 -c wireless-wpa.conf -dd
sudo dhclient wlan0

Leave a comment