Wireless with wpasupplicant easier then you think
Revised on: 11-16-2008 Changed wpa-driver to wext. Now also working with Kubuntu 8.10 i686 kernel 2.6.27-7-generic
Revised on: 09-01-2008 Now working with Kubuntu 8.04.1 i686 kernel 2.6.24-19-generic and Kubuntu 8.04 x86-64 kernel 2.6.24-19-generic.
Why use wpasupplicant? KNetworkManager works just fine. Yes KNetworkManager is fine but the pass phrase is stored in Kwallet and this means every time you want the network to connect you will have to put in your Kwallet password. Also if you for some reason need wireless to be up without starting the desktop environment you will need wpasupplicant because you will not be able to open up Kwallet in a terminal environment. Wpasupplicant will give you wireless all the time without having to use Kwallet.
As always the methods used here are tested by me and working on my boxes(we have 3 boxes with wireless through wpasupplicant).
There is a wpasupplicant user interface but I’ve never gotten it to work. So this how to is terminal commands only sorry “point and click” people.
First install wpasupplicant if you don’t have already.
sudo apt-get update && sudo apt-get install wpasupplicant
Now we create a pass phrase using a tool that was installed with wpa_supplicant the syntax is as follows:
wpa_passphrase ssid pass phrase
Where ssid is the name you gave the router and pass phrase is the phrase you used to secure your router.(If you don’t know or never have secured your router then this is the time to do so).
wpa_passphrase myrouter thisisalongpassphrasesonobodycanguess
the outcome of this is:
network={
ssid="myrouter"
#psk="thisisalongpassphrasenobodycanguess"
psk=fd50e5fb2b66493702338dd5175241d2e8dd7dd42fc292bbb7c56b01f9e9fdc0
}Time to create wpasupplicant’s config file:
sudo nano /etc/wpa_supplicant.conf
This will create a new file named wpa_supplicant.conf. I found out through experimentation that this file doesn’t need all the parameters as described in the man file. It only needs the following for my setup.
network={
ssid="myrouter"
psk=fd50e5fb2b66493702338dd5175241d2e8dd7dd42fc292bbb7c56b01f9e9fdc0
}You’re setup, router settings, might need more parameters. But for me this is all that is needed note that I removed #psk=”thisisalongpassphrasenobodycanguess” for security reasons.
We need to add the following to /etc/network/interfaces :
auto ath0
iface ath0 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant.confYou’re contents might be different maybe there is already some stuff in here maybe there is not (when you are using KNetworkManager for instance). When using 8.04 the driver might have to be changed to madwifi
Restart the network:
sudo /etc/init.d/networking restart
Or restart your box if that doesn’t work.
Now you should have wifi without using KNetworkManager.
Please post a comment and tell us if this worked for you or not in that case I will try to help you to get it fixed.
Tags: boxes, config, desktop environment, knetworkmanager, myrouter, nano, parameters, pass psk, phrase, point and click, setup router, syntax, user interface, wpa, wpa supplicant, wpa2, wpa_supplicant



I am also in need of help to try make my laptop wireless conection work. I followed the instructions on this blog and had no luck yet. Compilation, reboots, wpa-supplicant, etc.
I even changed from kubuntu to ubuntu, both hardy 8.0.4.1. Compiled everything etc. The drivers seems to go up but I dont get an IP or even a list of available APs to connect to. Very much in the dark here.
Wired is working fine. I am using it to send this.
Here is my basic configuration:
______
lspci:
03:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)
(the address is different of your example, I guess it should since this is not a Toshiba. It is actually from a Brazilian make called Evolute PC. I will try to trace its pedigree. Maybe something like Clavo, maybe not)
________________________
/etc/network/interfaces:
auto lo
iface lo inet loopback
iface ath0 inet dhcp
wireless-essid pavio-curto
wpa-driver madwifi
wpa-conf /etc/wpa_supplicant.conf
_________
iwconfig:
lo no wireless extensions.
eth0 no wireless extensions.
wifi0 no wireless extensions.
ath0 IEEE 802.11g ESSID:”" Nickname:”"
Mode:Managed Frequency:2.417 GHz Access Point: Not-Associated
Bit Rate:0 kb/s Tx-Power:17 dBm Sensitivity=1/1
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=0/70 Signal level=-96 dBm Noise level=-96 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
________
ip addr:
1: lo: mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1492 qdisc pfifo_fast qlen 1000
link/ether 00:14:0b:49:11:d4 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.3/24 brd 192.168.0.255 scope global eth0
inet6 fe80::214:bff:fe49:11d4/64 scope link
valid_lft forever preferred_lft forever
3: wifi0: mtu 1500 qdisc pfifo_fast qlen 280
link/ieee802.11 00:17:c4:23:ef:6d brd ff:ff:ff:ff:ff:ff
4: ath0: mtu 1500 qdisc noqueue
link/ether 00:17:c4:23:ef:6d brd ff:ff:ff:ff:ff:ff
inet6 fe80::217:c4ff:fe23:ef6d/64 scope link
valid_lft forever preferred_lft forever
Although there is no IPv4 IP associated to ath0, there is one IPv6 and dmesg has some (not many) error messages like:
____________
ath0: no IPv6 routers present
eth0: no IPv6 routers present
____________
It seems it can be normal as I dont have an IPv6 router available.
dhclient ath0 returns:
____________________
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
wifi0: unknown hardware address type 801
wifi0: unknown hardware address type 801
Listening on LPF/ath0/00:17:c4:23:ef:6d
Sending on LPF/ath0/00:17:c4:23:ef:6d
Sending on Socket/fallback
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 11
No DHCPOFFERS received.
No working leases in persistent database – sleeping.
______________
I dont know if the error:
___________
wifi0: unknown hardware address type 801
___________
is relevant or not.
By the way, I changed the configuration in /etc/dhcp3/dhclient.conf so ath0 would get a fixed IP address (192.168.0.4) and I could actually ping that IP. I dont know, maybe this shows that the wireless device is working? As, besides geting ping to work locally, there was no more progress I changed the configuration back to default.
Well, of course, I dont know where the problem is hiding itself. Remains the fact that the wireless conection still does not work while everything else seems to be fine: sound, video, the wired conection, etc.
I would really appreciate any help here.
Thanks a lot.
[Reply]
Marcos Euzebio wrote:
If you are going to use a fixed IP then you have to declare so in /etc/network/interfaces.
I’m assuming here that you’re router is 192.168.0.1 if not then change this
Also please post the result of:
and
[mad]Berry
[Reply]
I have installed Ubuntu 8.10 on my HP dv6910us laptop, but am not able to get my wireless card working. I followed the procedure on http://madberry.org/2008/11/how-to-get-atheros-ar242x-to-work-on-810-intrepid-ibex/ but $iwconfig gives “Access point: Not-Associated”. So,I followed the procedure posted here, but on restarting the network, I get the following error message
http://pastebin.ubuntu.com/72743/
lspci | grep Atheros gives :
03:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)
Any help is appreciated. Thanks.
[Reply]
[mad]Berry Reply:
November 16th, 2008 at 2:34 am
You will need to change the wpa-driver madwifi to wpa-driver wext in /etc/network/interfaces also change ath0 to wlan0.
Let me know if this works,
[mad]Berry
[Reply]
Per your instructions I did get my Artheros wireless to work and connect to unsecured networks, but was unable to connect to my encrypted network. I then ran the above commands but cannot tell if they worked. The indicator at the top of my screen that used to show up to indicate which networks were available and allowed me to select one has disappeared. I do still have wireless connection to the internet. So I am unable to tell which network I am connected to from this computer, the nearby unsecured network or my encrypted network and cannot change to another network either. I’m pretty sure I’m connected to the unsecure because I just unplugged my router and did not lose connection here, but only on my other pc. I’m not sure what to try next.
If I need to send more info, please tell me how to use the pastebin also. I saved all my terminal screen if needed.
Also, I would like to confirm: is the passphrase the same thing as the WEP encryption key?
Thank you!
KC
[Reply]
[mad]Berry Reply:
December 17th, 2008 at 5:50 pm
@Kelly -
You Mean the Network manager?
If you have to put in a passphrase then you are using WPA not WEP.
[mad]Berry
[Reply]
@[mad]Berry – There was originally 2 icons, one that was the Network Mgr that looked like 2 computers. The other icon was similar to the cell phone kind of icon, with the four bars? This second one is where I could see all the available networks and their strength. Now that information is probably still available, I just don’t know where to look.
Your questions made me wonder if I need to do something at my router set up to change it from the WEP to WPA?
My router and ethernet cable is attached to a Windows XP desktop computer. The pc I’m trying to set up wireless is a laptop.
[Reply]
This is indeed the case WPA has better encryption any way so that is always a good idea.
Sorry for the late response your comment ended up in the spam box.
[mad]Berry
[Reply]
I’m on ubuntu 8.10 – connectinog to secure lan and work… struggled trying all sorts of things… found this web page … tried the suggestions … everything works!
I think the title accurately sums up the situation. Thanks alot!
[Reply]
ive the same problem with my atheros… i cant define an acess ppoint
[Reply]
I followed the advice on this page, after the [blank] Ubuntu Hardy Gnome network applet just would not work. So far, so good. I’ll see how my laptop reconnects after waking up from hibernation.
Thanks a lot for the page. I ditched Intrepid because of the [blank] gnome network applet. It would take like ages (sometimes like 45 minutes) to connect to my WPA access point.
ta,
t.
[Reply]
Hello, thank you for your HowTo.
My router is using wpa2 encryption. I’ve installed wpasupplicant and made a config for it
After restarting the network i’m getting a message that wpa_supplicant daemon failed to start
[code]
* Reconfiguring network interfaces...
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/ra0/00:1f:1f:18:0a:7a
Sending on LPF/ra0/00:1f:1f:18:0a:7a
Sending on Socket/fallback
DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 8
receive_packet failed on ra0: Network is down
Terminated
Failed to bring up ra0. [ OK ][/code]
And here is mine /etc/network/interfaces
[code]auto ra0
iface ra0 inet dhcp
#address 192.168.1.65
#gateway 192.168.1.254
#dns-nameservers 192.168.1.254
#netmask 255.255.255.0
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
#wpa-ssid BTHomeHub2-3ZF4
#wpa-ap-scan 1
#wpa-proto RSN
#wpa-pairwise CCMP
#wpa-group CCMP
#wpa-key-mgmt WPA-PSK
#wpa-psk xxx
[/code]
what could be the problem?
[Reply]
[mad]Berry Reply:
March 24th, 2009 at 12:42 pm
What comes before [code]? That is where the problem should be....
[Reply]