HowTo: WPA with wpa_supplicant
Here was my first HowTo about this topic. It made a success, but now it's a bit out-to-date, as it was written for Hoary.
This stuff has started getting easier to configure since Breezy and now it's really very easy to have it work.
This HowTo will help you get WPA to work, no matter what wireless card you have. (This HowTo has been tested with an ipw2200).
So, let's start:
1) Open a terminal window and type:
Code:
wpa_passphrase your_ssid your_psk
Note: your_ssid is the name of your wireless network (a.k.a. SSID) and your_psk is the password you want to use to protect your network. (Look below for an example).
2) Now copy the psk string you got as output.
3) Type:
Code:
sudo gedit /etc/wpa_supplicant.conf
Then paste this as follow:
Code:
ctrl_interface=/var/run/wpa_supplicant
#ap_scan=2
network={
ssid="your_ssid"
scan_ssid=1
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk=your_psk
}
Note: your_psk is the psk string you got from step 1.
Here is an example:
Code:
luca@laptop1:~$ wpa_passphrase mywlan thisisthepassword
network={
ssid="mywlan"
#psk="thisisthepassword"
psk=b22ec921c254c73f99b31b76ff876692ecde36839a1f2d92150829e6afcb5515
}
The red string is what you have to paste into /etc/wpa_supplicant.conf as your_psk (without quotes obviously). So you'll have something like this:
Code:
ctrl_interface=/var/run/wpa_supplicant
#ap_scan=2
network={
ssid="mywlan"
scan_ssid=1
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk=b22ec921c254c73f99b31b76ff876692ecde36839a1f2d92150829e6afcb5515
4) Save the file and close Gedit.
5) Now we have to make wpa_supplicant load when system boots, so go back to the terminal window and type:
Code:
sudo gedit /etc/network/interfaces
6) Add the following lines in the part regarding your wireless card, as in the example below:
Code:
pre-up wpa_supplicant -Bw -Dwext -ieth0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant
Note: "eth0" is your wireless device and "wext" is the driver; this is a kind of generic driver, so it should work with most wireless cards. If it doesn't, please try another driver, such as hostap, ndiswrapper, etc.
Here is an example:
Code:
iface eth0 inet static
address 192.168.1.15
netmask 255.255.255.0
wireless-essid my_essid
gateway 192.168.1.1
pre-up wpa_supplicant -Bw -Dwext -ieth0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant
7) Now run wpa_supplicant:
Code:
sudo wpa_supplicant -Bw -Dwext -i eth0 -c/etc/wpa_supplicant.conf
You should be online!
Troubleshooting:
You can run wpa_supplicant with -dd flag for a detailed debug output.
1) If you don't manage to connect to the AccessPoint, try to uncomment line 2 in /etc/wpa_supplicant.conf.
2) If that doesn't help, try change its value to 0 or 1.
3) If you get troubles while authenticating, try removing "RSN" and/or "CCMP" strings from /etc/wpa_supplicant.conf.
Re: HowTo: WPA with wpa_supplicant
Only like to say that if you put the string in "/etc/network/interfaces" you will get an error if you try to reload the DHCP "sudo ifup -a --force"
I would go for a boot script in the /etc/init.d/your_own_script
And add it using
Code:
update-rc.d -f your_own_script start 40 S .
Re: HowTo: WPA with wpa_supplicant
If you use DHCP, your /etc/network/interfaces should look like the following:
Code:
auto eth0
iface eth0 inet dhcp
pre-up wpa_supplicant -Bw -Dwext -ieth0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant
Does this cause that error?
Re: HowTo: WPA with wpa_supplicant
I know you should not enter the IP etc if using DHCP.
I did get an error
Code:
/etc/network/interfaces:12: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"
But what was because of this:
Code:
iface eth0 inet dhcp
auto eth0
Instead of:
Code:
auto eth0
iface eth0 inet dhcp
Strange this only happen if I enter the pre-up/down to the interface file
Re: HowTo: WPA with wpa_supplicant
Another thing is that if you use the interface file and you dis/enable you network interfaces, it over writes the interface file.
Re: HowTo: WPA with wpa_supplicant
I am so close - I can almost taste it, but still not having luck. Can someone direct me?
I am running a LAMP server with a Linksys card running the Broadcom chipset. It can see the access point, but it won't hook up correctly. Here's the output of iwlist
Code:
eth0 Scan completed :
Cell 01 - Address: 00:0C:41:D0:46:A0
ESSID:"matthewboh"
Protocol:IEEE 802.11g
Mode:Master
Channel:6
Encryption key:on
Bit Rates:54 Mb/s
Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
Quality=100/100 Signal level=-145 dBm
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
Extra: Last beacon: 270ms ago
and here's what the iwconfig brings back
Code:
eth0 IEEE 802.11b/g ESSID:"matthewboh" Nickname:"Broadcom 4318"
Mode:Managed Frequency=2.484 GHz Access Point: Invalid
Bit Rate=11 Mb/s Tx-Power=19 dBm
RTS thr:off Fragment thr:off
Encryption key:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
The contents of the wpa_supplicant.conf
Code:
# Minimal /etc/wpa_supplicant.conf to associate with open
# access points. Please see
# /usr/share/doc/wpasupplicant/wpa_supplicant.conf.gz for more complete
# configuration parameters.
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1
### Associate with any open access point
### Scans/ESSID changes can be done with wpa_cli
# network={
# ssid=""
# key_mgmt=NONE
# }
# reading passphrase from stdin
network={
ssid="matthewboh"
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKPI
group=CCMP TKPI
psk=c43ae013621f4aa1db2d1127664349f425a2852c352c2c1d6913bfb056736b8d
}
Re: HowTo: WPA with wpa_supplicant
@ mattewboh: Are you trying without any protection/encryption? Otherwise, could you post the output of
Code:
sudo wpa_supplicant -Bw -Dwext -i eth0 -c/etc/wpa_supplicant.conf -dd
?
Re: HowTo: WPA with wpa_supplicant
Quote:
Originally Posted by
yopnono
I know you should not enter the IP etc if using DHCP.
I did get an error
Code:
/etc/network/interfaces:12: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"
But what was because of this:
Code:
iface eth0 inet dhcp
auto eth0
Instead of:
Code:
auto eth0
iface eth0 inet dhcp
Strange this only happen if I enter the pre-up/down to the interface file
Yeah, that's a bit strange.
Re: HowTo: WPA with wpa_supplicant
It just comes back with
Daemonize...
Re: HowTo: WPA with wpa_supplicant
Quote:
Originally Posted by
matthewboh
It just comes back with
Daemonize...
Oh sorry, my mistake, I meant:
Code:
sudo wpa_supplicant -w -Dwext -i eth0 -c/etc/wpa_supplicant.conf -dd