Saturday, May 13, 2006

Ubuntu WPA Goodness

Every six months Linux grows better by an order of magnitude. 2 1/2 years ago I was using Debian Potato and very excited when I could get graphics to work.

Today I am using the new Ubuntu Dapper Beta and was wondering why it is so hard to set up a dual monitor on Linux and why wireless connections are not as easy as using ethernet on Linux.

I have read that some company is donating their wireless framework, so I would guess that in 6-12 months the mixture of different wireless configurations will go away and we will have an easy way for Linux users to connect wirelessly. Today I am okay setting up basic wireless connections but at home I set up a WPA-PSK [TKIP] or WPA2-PSK [AES] connection. At work we use WPA2 [AES] connection exclusively. Up until today, I didn't think their was a way to get this working on Ubuntu or Debian without doing something really difficult.

Here is how to set up WPA under Ubuntu Dapper's Live CD portion. The live CD already has the wpa_supplicant package installed. The installed version might not have it installed, so verify the installation with your package manager.
All the pieces are available on the LiveCD, you just need to know how to activate them.

1. Enable the wireless network with the GUI through System-->Administration-->Networking


I had to Activate my wireless adapter and change the properties to use DHCP. I also verified that my SSID of my wireless device was listed.

2. Copy a configuration file for wpa_supplicant to the home directory.


zcat /usr/share/doc/wpasupplicant/examples/wpa_supplicant.conf.gz > ~/wpa_supplicant.conf

3. Modify the configuration file with your WPA secret code. This will append the basic configuration for WPA to the end of the configuration file. Fill in your own SSID and passphrase :)


wpa_passphrase SSID Passphrase >> ~/wpa_supplicant.conf

4. Now we just have to run the wpa_supplicant program with some specific settings to your environment. First lets find out what interface your card is using. Usually your device is something like wlan0 or ath0. Here are the interfaces you should avoid (eth0 is for your network card and lo is the loopback device).

ifconfig

5. Now you will have to run wpa_supplicant with no arguements to first get the list of drivers or just use this list to figure out what driver your card fits into. Use the 'lspci' command to help.


drivers:
hostap = Host AP driver (Intersil Prism2/2.5/3)
madwifi = MADWIFI 802.11 support (Atheros, etc.)
atmel = ATMEL AT76C5XXx (USB, PCMCIA)
wext = Linux wireless extensions (generic)
ndiswrapper = Linux ndiswrapper
ipw = Intel ipw2100/2200 driver
wired = wpa_supplicant wired Ethernet driver

6. Finally, we are ready for the command. I will be using the driver and interface for my card, you will have to adjust it to your situation.

sudo wpa_supplicant -c/home/ubuntu/wpa_supplicant.conf -Dmadwifi -iath0