WiFi with WPA under Ubuntu/Debian
I finally made my new laptop connect with WPA encryption to my WiFi router!!
I could already connect it to WiFi networks with WEP encryption (or no encription at all), but WPA proved harder.
Mini HowTo
1) My setup is the following:
WiFi router: SMC Barricade WBR14-G2
WiFi card in laptop: Intel PRO/Wireles 3945
OS: Ubuntu 6.06 LTS (Dapper Drake)
2) The router settings:
Wireless encryption: WPA/WPA2 Only
Cipher suit: TKIP+AES (WPA/WPA2)
Authentication: Pre-shared Key (yes, I know 802.1X would be more secure… sue me)
Pre-shared key type: Passphrase (8~63 characters)
3) The package one needs to install:
# aptitude install wpasupplicant
4) Making WPA supplicant run:
First, create a config file, by the name /etc/wpa_supplicant.conf, and inside it, write:
ctrl_interface=/var/run/wpa_supplicant ap_scan=1 network={ ssid="your_ssid_name" scan_ssid=0 proto=WPA RSN key_mgmt=WPA-PSK pairwise=TKIP CCMP group=TKIP CCMP psk="your_preshared_key" priority=5 }
At that point, you should make sure that the WiFi is turned on, and that the correct driver is loaded. In my case:
# modprobe ipw3945
Then, to test the WPA supplicant, run:
# wpa_supplicant -Dwext -ieth1 -c /etc/wpa_supplicant.conf
Recall I have used the wext device, instead of the ipw one, that would seem the appropriate one. Well, I read somewhere, that with 2.6.16 kernels and newer, this should be the case. Now I recall that my kernel is 2.6.15… nevermind, it works that way, and not the other (with -Dipw).
Recall also that my wireless device is eth1. Your mileage may vary (but each wireless card model gives rise to a precise device name, don’t worry).
If everything went fine, the output for the above command should be something like:
# wpa_supplicant -Dwext -ieth1 -c /etc/wpa_supplicant.conf
Trying to associate with xx:xx:xx:xx:xx:xx (SSID='xxxxxxxx' freq=0 MHz)
CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
Authentication with 00:00:00:00:00:00 timed out.
Associated with xx:xx:xx:xx:xx:xx
WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed (auth)
If you see that “negotiation completed”, it worked (Ctr-C to exit the above).
5) Automating the WPA connection when bringing wireless interface up
Next, I’ll explain the small changes one has to make to /etc/network/interfaces to correctly bring up the interface. As I said, my wireless interface is eth1, so, I added the lines below to the aforementioned config file:
iface eth1 inet dhcp
wireless-essid my_wireless_essid
pre-up wpa_supplicant -Bw -Dwext -ieth1 -c /etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant
And that’s all! Whenever you ifup eth1, you’ll bring up the wireless interface, with WPA encryption working.