LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 01-09-2015, 04:02 PM   #1
wrobertz
LQ Newbie
 
Registered: Oct 2007
Posts: 15

Rep: Reputation: 0
Can't get wpa_supplicant to associate/connect w/ my AP; used to work reliably...


Greetings! Last night, my ISP, Comcast, went down for a couple hours. I have wireless interface that is properly configured to use wpa_supplicant, and it has been working smoothly for some time now. However, after Comcast came back up, I haven't been able to get things working since then. (I've rebooted the router, rebooted my laptop, nothing works...) It tries to connect w/ my WPA2 protected network AP (HOME-6C53-2.4), but fails after a short period (~10secs), and then rescans and finds another open network AP (xfinitywifi) in the neighborhood and connects with that. This happened once before, unbeknownst to me, and for a long time, I couldn't figure out why I couldn't print documents on a printer that was connected to my AP. Finally, I rebooted the router and discovered that I had been connected not to my protected AP, but to the open AP!

I'm running Slackware 14.0, and start the wireless interface via '/etc/rc.d/rc.inet1 restart'. I actually have a short script that mimics each step produced by rc.inet1 (and rc.wireless), which does the following:
sudo /sbin/dhcpcd -k -d wlan0
sudo killall wpa_supplicant
sleep 1
sudo /sbin/ifconfig wlan0 down
sudo /usr/sbin/wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
i=0
ns=1
while true ; do
i=$((i+1))
sts=$(/usr/sbin/wpa_cli -iwlan0 status | \
egrep '^ssid=|wpa_state=')
echo "sts($i): $sts"
echo $sts | grep -q "wpa_state=COMPLETED" && break
sleep $ns
done
sudo /sbin/ifconfig wlan0 up
sudo /sbin/dhcpcd -d -t 20 wlan0
sudo /sbin/iwconfig wlan0

The (abbreviated) output for these steps is the following:
sts(1): wpa_state=DISCONNECTED
sts(2): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(3): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(4): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(5): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(6): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(7): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(8): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(9): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(10): wpa_state=DISCONNECTED
sts(11): ssid=xfinitywifi
wpa_state=COMPLETED
....
Also, I've noticed that if I wait less time (e.g., 0.2secs) between the calls to wpa_cli, I see a value of wpa_state=SCANNING before it switches to ssid=xfinitywifi. Also, I sometimes see wpa_state=ASSOCIATING and wpa_state=ASSOCIATED. I don't remember seeing 'wpa_state=4WAY_HANDSHAKE' before, although I didn't used to check the wpa_state values returned by the wpa_cli commands (except for wpa_state=COMPLETED). As shown above, wpa_supplicant spends most of its time trying to do a 4WAY_HANDSHAKE.

I've looked at the /var/log/debug, and it shows that the AP (bssid=20:25:64:e2:3f:d0) is being authenticated and associated, then it is disassociated and deauthenticated:
Jan 9 13:36:18 werz kernel: [12267.310305] wlan0: authenticate with 20:25:64:e2:3f:d0 (try 1)
Jan 9 13:36:18 werz kernel: [12267.312596] wlan0: authenticated
Jan 9 13:36:18 werz kernel: [12267.312647] wlan0: associate with 20:25:64:e2:3f:d0 (try 1)
Jan 9 13:36:18 werz kernel: [12267.316962] wlan0: RX AssocResp from 20:25:64:e2:3f:d0 (capab=0x431 status=0 aid=2)
Jan 9 13:36:18 werz kernel: [12267.316971] wlan0: associated
Jan 9 13:36:22 werz kernel: [12271.318762] wlan0: disassociated from 20:25:64:e2:3f:d0 (Reason: 2)
Jan 9 13:36:22 werz kernel: [12271.357889] wlan0: deauthenticating from 20:25:64:e2:3f:d0 by local choice (reason=3)

Also, I've tried doing 'sudo iwconfig wlan0 essid HOME-6C53-2.4' before the call to wpa_supplicant, but that doesn't help much -- it tries, then after a period of time, rescans and connects to 'xfinitywifi' instead. I can block connecting to open AP's by editing the /etc/wpa_supplicant.conf file, but I'd rather not do that. (I like being able to connect while in coffee shops that have open networks, but I'm aware that it's an open AP.)

I booted into Windows 7, and it connected to HOME-6C53-2.4 no problem (so at least I have a fall-back when I need a secure connection). This is one of those cases where "it used to work, now it doesn't"...

I'm really stumped here! Don't want to have to become an expert in wpa_supplicant, and the whole handshaking process when an AP connects. Hopefully, someone can help me out here!

Anyone? I'm really stuck here...

Thanks!
 
Old 01-10-2015, 08:44 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,254

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
Quote:
It tries to connect w/ my WPA2 protected network AP (HOME-6C53-2.4), but fails after a short period
You are losing me here. Your AP is the mac address of your router, found by running
Quote:
iwlist wlano scan |less
and picking ourt your one from the others around. Here's one of my neighbours
Code:
          Cell 14 - Address: BC:8C:CD:3E:A3:08
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=22/70  Signal level=-88 dBm  
                    Encryption key:on
                    ESSID:"UPC242851442"
                    {SNIP!}
The AP is the mac address on line 1. But even if we had the password, you probably wouldn't reach him from here :-P.
 
Old 01-10-2015, 05:10 PM   #3
wrobertz
LQ Newbie
 
Registered: Oct 2007
Posts: 15

Original Poster
Rep: Reputation: 0
Hi there. My mac address is 20:25:64:e2:3f:d0, as shown in the /var/log/debug lines shown above, or by using iwlist as stated above. Don't know what good that will do, except to locate the proper lines in some of the /var/log lines.

An IT friend suggested that when the router rebooted, it may have updated the firmware to the latest version. Assuming this is true, Windows 7 seems to handle this firmware update okay, whereas Linux/wpa_supplicant doesn't. (Is this true???) Rich said this has happened to him in the past, and he's had to spend some time on the phone w/ Comcast to remedy the situation. I'm hesitant to get on the phone w/ Comcast tech support, since more likely than not, they'd respond w/ "We don't support Linux..." Similarly, sometime last year, Comcast/Xfinity upgrade their upgraded to viewer to require v. 11.8.0 or later of Adobe Flash. (My Firefox has v. 11.2.202.) If you go onto Adobe's website, there's a note saying "Adobe Flash Player 11.2 will be the last version to target Linux as a supported platform. Adobe will continue to provide security backports to Flash Player 11.2 for Linux." My workaround is to use Google Chrome instead of Firefox if/when I want to use their viewer. My point is that Comcast has dumped lots of Linux customers in their decision to move forward. So I'm not very encouraged in calling tech support. But plan to bite the bullet and call them this afternoon... Thing is, I really don't have the technical expertise to diagnose the problem; thus this post.

Has anyone had similar experience w/ Comcast routers, that may have been recently upgraded and resulted in incompatibilities w/ wpa_supplicant? Or, do I need to grab the most recent version of wpa_supplicant that may better handle wpa_state=4WAY_HANDSHAKE? At this point, I'm (very cautiously) using the open network 'xfinitywifi'. I reboot into Windows 7 to do work that requires a secure connection (e.g., financial crap) or to print documents. Actually, I just thought of something -- I'm going to try to connect thru an ethernet cable; I don't mind sitting close to the router.

One other thing -- I'm not averse to installing another Linux distro, or using a live Linux distro DVD, to see if the problem is handled better by another. Also, could be time to update my version of Slackware; I've been using Slackware forever (since 1995?) and am comfortable (lazy?) with that. I should probably someday try other flavors of Linux.

Just found a web site that stated that if I'm getting wpa_state=4WAY_HANDSHAKE, that means that password authentication is wrong. The thing is that a) I haven't changed it since it was working smoothly, and b) it works under Windows 7.

Thanks!
 
Old 01-11-2015, 04:34 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,254

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
Stop all network processes (wpa, dhcp, etc) and try something like this
Code:
ifconfig wlan0 up
iwlist wlano scan |less
run a mouse over the mac address of your own router
Code:
wpa_supplicant -c/etc/wpa_supplicant.conf -i wlan0 -Dwext && 
iwconfig wlan0 essid your_essid  ap <paste mac address of router>
dhcpcd wlan0
That relies on your psk in/etc/wpa_supplicant.conf as being that supplied by wpa_passphrase.
 
Old 01-11-2015, 02:26 PM   #5
wrobertz
LQ Newbie
 
Registered: Oct 2007
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks @business_kid, I tried what you said, got the following:

wpa_supplicant -c/etc/wpa_supplicant.conf -i wlan0 -Dwext &&
> iwconfig wlan0 essid your_essid ap 20:25:64:E2:3F0
wlan0: Trying to associate with 20:25:64:e2:3f:d0 (SSID='HOME-6C53-2.4' freq=2437 MHz)
wlan0: Associated with 20:25:64:e2:3f:d0
wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
wlan0: CTRL-EVENT-DISCONNECTED bssid=20:25:64:e2:3f:d0 reason=0
wlan0: Trying to associate with 20:25:64:e2:3f:d0 (SSID='HOME-6C53-2.4' freq=2437 MHz)
wlan0: Associated with 20:25:64:e2:3f:d0
wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
wlan0: CTRL-EVENT-DISCONNECTED bssid=20:25:64:e2:3f:d0 reason=0
wlan0: Trying to associate with 06:3e:0c:9d:49:f0 (SSID='xfinitywifi' freq=2412 MHz)
wlan0: Associated with 06:3e:0c:9d:49:f0
wlan0: CTRL-EVENT-CONNECTED - Connection to 06:3e:0c:9d:49:f0 completed (auth) [id=16 id_str=]

I even tried using the 256bit psk produced by wpa_passphrase, same result. The thing is, as stated in my 1st post, this used to work fine up until the Comcast outage. After they came back up, it's never worked -- always fails doing the 4-Way Handshake. I spent 1.5hrs yesterday on the phone w/ a tech support person from Comcast, and we couldn't resolve the issue. (Granted, she wasn't that familiar w/ Linux...) She couldn't even tell me if the router had been flashed w/ an update to the router's firmware (which is what I suspect happened...). So, I'm off to Comcast to swap the router. Hope that helps!
 
Old 01-11-2015, 08:50 PM   #6
wrobertz
LQ Newbie
 
Registered: Oct 2007
Posts: 15

Original Poster
Rep: Reputation: 0
Well, went to Comcast to exchange the router/modem. Works now, so the issue is moot. Somehow, after the Comcast outage, things changed with the router. Windows seems to have dealt okay w/ the change (Comcast probably tested the change against Windows & Macs), whereas Linux didn't. I probably will never know what really happened. Oh well...

Thanks, @business_guy, for the suggestions, especially running wpa_supplicant in foreground mode -- it became clear what was happening.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Making X11 work reliably on a Xen 4.1 dom0, with some caveats Gullible Jones Linux - Virtualization and Cloud 1 07-12-2013 10:47 AM
wpa_supplicant can t associate with ndiswrapper driver pomard Linux - Wireless Networking 4 01-12-2010 09:12 PM
iptables rule: ssh does not connect reliably Robert S Linux - Networking 3 12-08-2007 08:04 AM
Special function (Fn) keys don't work reliably in Suse 10.1 on Evesham laptop Paul Williamson Linux - Laptop and Netbook 0 02-10-2007 09:57 AM
Cannot get wpa_supplicant to associate on ipw2100 mennowo Linux - Wireless Networking 5 10-26-2006 08:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

All times are GMT -5. The time now is 05:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration