I am now able to connect to WPA2 wireless networks (or at least my network) with wpa_supplicant with one tiny problem remaining. My process follows:
With wpa_supplicant.conf set to connect to an unsecured wireless network, I ran wpa_supplicant with both wext and nl80211 drivers and with values 0, 1, and 2 for ap_scan (set in wpa_supplicant.conf). I think that it gave a fairly uninteresting failure message. When I ran it with verbose output (-d), I got a whole bunch of information that I didn't know what to do with, including the line "Driver does not support WPA." This happened for all combinations of driver and ap_scan setting.
I changed my kernel config so that
Networking->Wireless->cfg80211 wireless extensions compatibility (CFG_80211_WEXT) was enabled. I suspect that d2_racing may bang his head against his desk as he reads this. I also enabled
Wireless extensions sysfs files below it in case that was useful. Then, I rebuilt and reinstalled the kernel. When I rebooted, I got this during init:
Code: Select all
Starting wlan0
Starting wpa_supplicant on wlan0 ...
Starting wpa_cli on wlan0 ...
Backgrounding ...
There were no init errors associated with wlan0, and when I logged in, ifconfig showed that wlan0 was up, but iwconfig (which now works since wireless extensions are supported) showed "Access Point: Not-Associated", and ping said "connect: Network is unreachable". But wpa_supplicant was running, so I messed around in wpa_cli. The status command initially said something discouraging, I think "ASSOCIATING". Long story short, the only thing that made any difference was changing the value of
ap_scan. 0 and 1 didn't do anything, but right after I changed it to 2, I got this output:
Code: Select all
<2> CTRL-EVENT-SCAN-RESULTS
<2> Trying to associate with <router's MAC address> (SSID=<my SSID> freq=2412 MHz)
<2> Associated with <router's MAC address>
<2> CTRL-EVENT-CONNECTED - Connection to <router's MAC address> complete (auth) [id=0 id_str=]
OK
After that,
status' output was
Code: Select all
bssid=<router's MAC address>
ssid=<my SSID>
id=0
pairwise_cipher=NONE
group_cipher=NONE
wpa_state=COMPLETED
ip_address=192.168.2.8
I'm not sure how I got that IP address, but I had IP connectivity when I quit wpa_cli and pinged the router. Probably dhcpcd started in init and was running that whole time waiting for Ethernet connectivity. I disconnected and set ap_scan=2 in my wpa_supplicant.conf, after which I was able to reconnect by running wpa_supplicant with the wext driver, then running dhcpcd. I was also able to do it with the nl80211 driver. Thus, I'm unclear on what my kernel reconfiguration actually did.
d2_racing wrote:Code: Select all
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
ap_scan=0
#update_config=1
network={
ssid="your_SSID"
psk="your_PASSWORD"
proto=WPA2
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
priority=5
}
I added details to my wpa_supplicant.conf as suggested and turned WPA2 on in my router. When I rebooted, I got no init errors, but I wasn't connected. wpa_cli status output "ASSOCIATING". Interactively, wpa_cli repeated output
Code: Select all
<2> CTRL-EVENT-SCAN-RESULTS
<2> Authentication with 00:00:00:00:00:00 timed out
<2> Trying to associate with SSID <my SSID>
Sidebar: At this point, I rebooted and stopped all net services.
ifconfig wlan0 up gave "SIOCSIFFLAGS: Unknown error 132". A quick Google search revealed that this means you have to turn your hardware radio switch on. Mine was already on, so I turned it off, then on, and that fixed the problem. I never had to do this before, and I have never yet had to do it since. I don't know whether it is at all related to this problem. Now back to the story.
With wlan0 up but with no net services running, I ran wpa_supplicant with both the nl80211 and the wext drivers, and I got output similar to that seen in wpa_cli after I enabled WPA2. I commented out all of the specific information in the network block of my wpa_supplicant.conf so that it looked like this:
Code: Select all
ctrl_interface=/var/run/wpa_supplicant # needed for wpa_supplicant to work
ctrl_interface_group=wheel # keep users from seeing the configuration
ap_scan=2 # make wpa_supplicant scan and select APs
network={
ssid="<my SSID>"
# proto=WPA
key_mgmt=WPA-PSK
# pairwise=CCMP TKIP
# group=CCMP TKIP WEP104 WEP40
psk="<my password>"
# priority=10
}
Then, when I ran wpa_supplicant (either nl80211 or wext), I got
Code: Select all
Trying to associate with SSID '<my SSID>'
Associated with <router's MAC address>
Authentication with <router's MAC address> timed out
Trying to associated with SSID '<my SSID>'
CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
which repeated forever until I killed it. I was suspicious that my passphrase, which contains a " character, was not being read the way I wanted by wpa_supplicant, so I changed the password in the config file and in the router to "password". Running wpa_supplicant again with nl80211, I got
Code: Select all
Trying to associate with SSID '<my SSID>'
Associated with <router's MAC address>
WPA: Key negotiation completed with <router's MAC address> [PTK=CCMP GTK=CCMP]
CTRL-EVENT-CONNECTED - Connection with <router's MAC address> completed (auth) [id=0 id_str=]
WPA: Group rekeying completed with <router's MAC address> [GTK=CCMP]
the last line of which repeated immediately and later after I had backgrounded the process. After this, wpa_cli status gave
Code: Select all
bssid=<router's MAC address>
ssid=<my SSID>
id=0
pairwise_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
and I was able to get an IP address with dhcpcd and ping the router. When I rebooted and logged in, I had Layer 3 connectivity with WPA2 but a stupid password.
Now, I only want to know how to get wpa_supplicant to interpret the " character correctly in my passphrase. I have been enclosing my passphrase in " quotes in the file and escaping the " in my passphrase with \, like """. Can I do this? Do I need to use wpa_passphrase and put the hex key that gives me in wpa_supplicant.conf?