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:


  proto=WPA RSN
  pairwise=TKIP CCMP
  group=TKIP CCMP

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.

5 thoughts on “WiFi with WPA under Ubuntu/Debian

  1. "[...]ifup eth2
    dosn't work .... ADDRCONF (NETDEV_UP) link is not ready .
    NO DHCPOFFERS received !"

    Is the router leasing IPs correctly? Does it have DHCP correctly set up and running? The error sounds like the channel your WiFi card is listening to does not give IPs via DHCP. This could happen for various reasons: the router is not properly set up, the card is not listening to the proper channel/SSID, the card is banned from the router (because of encryption, MAC filter...), or the device you are using (eth2) is not the one the card is on.

    Are you sure eth2 is the correct device? In my case, eth0 is the ethernet device, and eth1 the WiFi card. If your card is not Intel, it may appear under another device name (Google for it, plus read output of dmesg in your machine).

    Moreover, can you connect when no encryption is set in your router? Try putting down all security measures in your wireless router. Can you connect like that?

    Try using the commands iwlist, ifconfig and iwconfig. They should tell you about the SSIDs that your computer can "see", and also about the device your OS assigns to the WiFi card.

    Hope that helps, and sorry if I'm telling you something you already know.

  2. Hi,

    I'm having the same problem which I couldn't solve yet. I tried calling wpa_supplicant, providing the settings in the /etc/networking/interfaces file.
    In 1 out of 10 test I succeed, but I can't say what I did to make it succeed. I see the message "eth1 link is not ready" and sometimes it says "eth1 link becomes ready". Could you tell me what you did?

    Thanks in advance,


  3. Pingback: What I’ve done to my laptop « handyfloss

  4. Pingback: WiFi with WPA under Ubuntu/Debian « handyfloss

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe without commenting