LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Wireless AP "not associated" problem (https://www.linuxquestions.org/questions/linux-newbie-8/wireless-ap-not-associated-problem-569770/)

cliffoij 07-16-2007 08:02 AM

Wireless AP "not associated" problem
 
Hello all

I have a NEWLINK USB pen wireless ethernet card connecting back to me wireless NETGEAR router. Card, and router, work fine on windows.

Hardware is IBM thinkpad 6004, 160 MB Ram, 10 GB disk.
OS = Knoppix 5.1 - kernel 2.6.19

I have set up wpa_supplicant, and assigned a manual address using the /etc/network/interfaces file. I have also set the default gateway.

Here's the problem - I see 6 AP's with "iwlist wlan0 scan" - and no matter how many times i issue "iwconfig wlan0 essid <myessid>" is always reverts back to sating "Any" and the essid does not get set. Same goes for setting the AP of the NETGEAR router with "iwconfig wlan0 ap xxxxxxxx" - the setting is not preserved.

The ESSID on the router is set to broadcast (i checked yesterday)

I have to use "iwpriv wlan0 network_type g" to get the correct listing for the network, but this setting IS preserved.

I have tried iwconfig mode wlan0 auto also.

The output from dmesg shows no problems with recognising the usb wireless newlink adapter, and is able to recognise hotplug of the device. I see nothing unusual.

I have been using "-Dwext " option for the startup of wpa_supplicant as the third party drivers produce a complaint about "WPA not supported" when i try and use them. I get no such message when using the "-Dwext" option, so I've stuck with that.

Is is just that I need to perhaps select a new channel (other than 6) with "iwconfig wlan0 channel <number>" to try and isolate mine form the others visible in my street (the other 5) or is there something more fundamentally wrong you think ?

I have to presume my wireless card is operational as it can "see" mine (and other) networks in the area - I just can't lock on to it.

I have read many threads and so far I have done what I can - any advice appreciated.

Thanks - Ian

tredegar 07-16-2007 12:19 PM

Your hardware seems to be working - I think you have an authentication problem. Make double-sure that you have the SSID correctly spelled, both on the AP and in your interfaces file

Here's the relevant part of my /etc/network/interfaces file:

Code:

auto eth1
iface eth1 inet static
broadcast 10.0.0.255
address 10.0.0.8
netmask 255.255.255.0
gateway 10.0.0.2
wpa-passphrase mysecretphraseishere
wpa-ssid MywirelessAPName
wireless-channel 11
wireless-essid MywirelessAPName
wireless-key s:mysecretphraseishere

Notes:
1] eth1 is my wireless interface, yours may be different, please double-check!
2] You may need to choose a different channel (same as your AP, obviously!)
3] 10.0.0.2 is the address of my modem/router/switch/AP
4] I have wpasupplicant installed
5] I like static IPs on my LAN, if you want dhcp make it look like this:

Code:

auto eth1
iface eth1 inet dhcp
wpa-passphrase mysecretphraseishere
wpa-ssid MywirelessAPName
wireless-channel 11
wireless-essid MywirelessAPName
wireless-key s:mysecretphraseishere

Edit your interfaces file, then, as root, try

ifdown eth1
ifup eth1

and (hopefully), you'll be connected.....

cliffoij 07-17-2007 03:22 AM

Hi tredegar

Thanks - your example /etc/network/interfaces file is interesting. I am on knoppix (which I understand to be a debian based distro) - I also notice you have an entry for both "wpa-passphrase" and "wireless-key" in the /etc/network/interfaces file.

I thought (perhaps incorrectly) that if you used WPA (in my case WPA-PSK) the wireless-key was not needed to be declared with "iwconfig" , but that the wpa-supplicant daemon took care of key exchanges via the wpa-supplicant.conf file ?

Hmmm - if it is required that the key is declared in both those elements this could be my problem ?

What I will try tonight is altering the channel / frequency of the AP broadcasts to make sure there is no kludge between them.

I am still baffled though as when I have been issuing the "iwconfig wlan0 essid XXXXX" command and the shell prompt is accepted, but the output from later "iwconfig wlan0" commands does not show the essid I just declared. It's just being flatly ignored. This suggests that encryption has to be spot on first prior to attempting to connect to my chosen AP / essid.

Out of interest - does your setup work without the "wireless-key s:mysecretphraseishere" entry in your /etc/network/interfaces file if you are using wpa_supplicant ?

Thanks - Ian

tredegar 07-17-2007 05:36 AM

I do not have a wpa-supplicant.conf file, but it all works fine.

Quote:

does your setup work without the "wireless-key s:mysecretphraseishere" entry in your /etc/network/interfaces file if you are using wpa_supplicant ?
Yes, if I comment out these two lines:
Code:

# wireless-essid MywirelessAPName
# wireless-key s:mysecretphraseishere

it still works. I am not sure where these last two lines came from - maybe from when I was playing with one of the GUIs - wlassistant, which does not seem to work very reliably - hence my resorting to editing the interfaces file by hand.

I do need these entries though:
Code:

wpa-passphrase mysecretphraseishere
wpa-ssid MywirelessAPName
wireless-channel 11

Quote:

I have been issuing the "iwconfig wlan0 essid XXXXX"
If you are going to use the command line like that, I'm pretty sure that you'll need to provide your key as well, something like this:

Code:

/sbin/iwconfig wlan0 mode managed channel 11 key restricted s:mysecretphraseishere essid MywirelessAPName
One last q: Can you see your AP with the command iwlist eth1 scanning ?
Check that it is broadcasting the right ESSID

cliffoij 07-17-2007 07:22 AM

OK -

One last q: Can you see your AP with the command iwlist eth1 scanning ?

Yes, I see not only my AP, but another 5 from the neighbours also !. Thats why I was trying to issue "iwconfig wlan0 ap xxxxxxxxxxxx" to set my specific mac address for the AP (also the router/gateway)

I have been looking at the "iwpriv" options I could supply (which so far I havent used many) and I will try tonight to experiment with these.

I have not been declaring WEP key via the "iwconfig" command as per your example :-

/sbin/iwconfig wlan0 mode managed channel 11 key restricted s:mysecretphraseishere essid MywirelessAPName

This is simply because the PSK key gets defined in there /etc/wpa_supplicant/wpa_supplicant.conf, in a file that looks like this :-

# WPA-PSK/TKIP

ctrl_interface=/var/run/wpa_supplicant

network={
ssid="Myessid"
key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
group=TKIP
psk="secret passphrase"
}


So tonight I will try and config using your exmaple, and also experiment a little with "iwpriv" commands, as in some distros I see you can declare the PSK key as an argument to "iwpriv" (amongst other settings).

Will catch up with you tomorrow - thanks for assistance so far - I have no doubt that having spent several days with this so far :)

Cheers - Ian

tredegar 07-17-2007 08:23 AM

Quote:

Yes, I see not only my AP, but another 5 from the neighbours also !
That's normal, I can see several (and half are "open") too. But my AP's ESSID is different from theirs, and I associate with that. No need for hardware MAC addresses.
Quote:

I have been looking at the "iwpriv" options
I have never had to use iwpriv, maybe you don't either - try not to complicate things!
Quote:

I have not been declaring WEP key via the "iwconfig" command as per your example ... because the PSK key gets defined in there /etc/wpa_supplicant/wpa_supplicant.conf
I have learnt never to make assumptions. As I said, I do not have a wpa_supplicant.conf file at all and everything works well, so my setup (kubuntu, which is also derived from debian), doesn't need that file (perhaps because I am specifying all that stuff in my interfaces file). For what it's worth, my /etc/wpa_supplicant directory contains a single file called ifupdown.sh and that's all.

If you make your interfaces file look like mine (with the obvious eth0 / wlan0 substitutions) and it still doesn't work, may I suggest you post your file in its entirety, without editing out or changing your ESSID or passwords? There may be something simple that is wrong. I spent the best part of a week with some guy who was convinced his ESSID was correct and that linux was "broken" and then it turned out that he was using Rapid Falls (or something like that) as his ESSID, when in fact it should have been Rapidfalls.
Security note: It is highly unlikely that anyone reading this is within 100m of you, and once you get it working, you can always change those security settings to something new.

cliffoij 07-18-2007 03:18 AM

SOLVED - Wireless AP "not associated" problem
 
Hi Tredegar - SOLVED :) !!! :)

I made my /etc/nertwork/interfaces file look similar to yours :) - thanks

I entered the "iwconfig wlan0 key restricted s:xxxxxxxxxxxx" and also set mode to "managed" along with the "ap_scan=1" option in my /etc/wpa_supplicant/wpa_supplicant.conf file (extract below)

I launch the wpa_supplicant process via the /etc/network/interfaces file (as a quick and dirty startup) so it's activated with "ifup wlan0" accordingly.

Amazingly, DHCP worked too (which staggered me) !

My prior downfall was presuming that the key statement was only required to be declared in the wpa_supplicant.conf file - Look like that's not the case.

All I need to do now is work out the correct method for clean startup and shutdown of the wpa_supplicant process - I'll look on the forums and documentation later today.

Thanks very much indeed for your help - muxch appreciated - now off to read up on clean startup/shutdown on process.

Sample code used below :-

Code : From /etc/network/interfaces :-

allow-hotplug irda0

iface irda0 inet dhcp
pre-up ifconfig irda0 up

auto wlan0
iface wlan0 inet dhcp
pre-up ifconfig wlan0 up
pre-up sh /etc/wpa_supplicant/start.sh > /dev/null & # My script to start wpa_supplicant
pre-up iwconfig wlan0 mode managed
pre-up iwconfig wlan0 channel 6
pre-up iwconfig wlan0 essid "MyEssid"
pre-up iwconfig wlan0 key restricted s:xxxxxxxxxxxx # xxxx= My key (WPA-PSK)
pre-up iwconfig wlan0 ap 00:0F:xx:xx:xx:xx # My AP (gateway/router)
pre-up iwpriv wlan0 network_type g

allow-hotplug wlan0

allow-hotplug wmaster0
iface wmaster0 inet dhcp
pre-up ifconfig wmaster0 up

Code : From /etc/wpa_supplicant/wpa_supplicant.conf

ap_scan=1

network={
ssid="myEssid"
proto=WPA
psk="mysecretphrase"
key_mgmt=WPA-PSK
pairwise=TKIP
}

tredegar 07-18-2007 03:40 AM

It is working - Congratulations!
Quote:

All I need to do now is work out the correct method for clean startup and shutdown of the wpa_supplicant process - I'll look on the forums and documentation later today.
I don't think you need to do this: wpa_supplicant is started automatically for me (maybe by whatever is reading the interfaces file?), and the process will simply be killed by the kernel as it shuts down, but if you'd like to look into it further, go ahead.

cliffoij 07-19-2007 05:31 AM

Hi again tredegar

Many thanks for helping this problem get resolved - much appreciated. I'm not going to lose any sleep over auto startup and shutdown as you suggest ... life's too short ..... ;-)

Have a good weekend !

cheers - Ian


All times are GMT -5. The time now is 02:38 AM.