# wpa_supplicant and problem with connecting to router

## wojcieh

Hello

I have got small problem with connecting to wireless router (Linksys WRT54G). With windows everythings work fine but i would like to be able using wifi on linux. 

This is output when i am trying to connect to router.

command: wpa_supplicant -Dndiswrapper -iwlan0 -c/etc/wpa_supplicant.conf -dd

```

Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'ndiswrapper' ctrl_interface 'N/A'

Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ap_scan=2

Line: 3 - start of a new network block

ssid - hexdump_ascii(len=7):

     6c 69 6e 6b 73 79 73                              linksys         

scan_ssid=1 (0x1)

proto: 0x1

key_mgmt: 0x2

pairwise: 0x8

PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED]

PSK (from passphrase) - hexdump(len=32): [REMOVED]

Line 10: removed CCMP from group cipher list since it was not allowed for pairwise cipher

Priority group 0

   id=0 ssid='linksys'

Initializing interface (2) 'wlan0'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

SIOCGIWRANGE: WE(compiled)=19 WE(source)=18 enc_capa=0xf

  capabilities: key_mgmt 0xf enc 0xf

Own MAC address: 00:14:a4:07:ba:3c

wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0

Setting scan request: 0 sec 100000 usec

Added interface wlan0

Wireless event: cmd=0x8b06 len=12

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

State: DISCONNECTED -> SCANNING

Trying to associate with SSID 'linksys'

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: No WPA/RSN IE available from association info

WPA: Set cipher suites based on configuration

WPA: Selected cipher suites: group 14 pairwise 8 key_mgmt 2

WPA: clearing AP WPA IE

WPA: clearing AP RSN IE

WPA: using GTK TKIP

WPA: using PTK TKIP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

No keys have been configured - skip key clearing

State: SCANNING -> ASSOCIATING

Setting authentication timeout: 60 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

CTRL-EVENT-TERMINATING - signal 2 received

Removing interface wlan0

State: ASSOCIATING -> DISCONNECTED

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

No keys have been configured - skip key clearing

Cancelling scan request

```

This is wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ap_scan=2

network={

   ssid="linksys"

   scan_ssid=1

   proto=WPA

   key_mgmt=WPA-PSK

   pairwise=TKIP

   psk="brzydaka"

}

```

And question, what can I do to connect and normal using of this device.

Thanks for all ips   :Very Happy: 

----------

## Valheru

Did you get this working? I'm having the same problem - I can't even connect to the damned thing under windows  :Sad: 

----------

## Allochtoon

Let me first say this: Until now I have never, never given up on anything under linux, sadly, wireless was the first time. I literally bought another card (Senao) for it to work. Sadly madwifi-ng still won't cooperate with wpa in my case. I use my old linksys card now, with ndiswrapper, and it only works without encryption at all. So thats a no go.

I literally tried -almost- everything, in your case i suggest wpa_passphrase to cloak your password, and trying it first without enc to take out problems. 

Or just buy a card based on a Prism chipset.

----------

## ghosterius

I have exactly the same problem here... I believe is a little problem with WPA2 in the wpa_supplicant... because with the WPA only I can connect... (at least with my "old" 138g from asus i could...) since now I'm using a D-Link G122 I'm having a bit of a problem connecting to WPA2... though I'm also using a Hidden SSID... the router is the same... and the problem is the same too! I will post here if I get any solution...

----------

## ghosterius

Well... it is definitly a problem with AES encription NOT WPA2 as I said before... although I got WPA in the WRT54G router and a TKIP cipher and it has no problem in fetching the connection and it is working great! I'm posting the configuration below... hope it helps...

 *Quote:*   

> 
> 
> ctrl_interface=/var/run/wpa_supplicant
> 
> ctrl_interface_group=0
> ...

 

[/quote]

----------

## jmanko

ghosterius, what are your configurations in /etc/conf.d/net?  Also, are you using udev 0.79, the kernel driver, etc?

----------

## r4di0_h34d

Okay...I'm also having problems connecting to my router.  I've got kernel 2.6.15-r1, and am using the ipw2200 kernel drivers.  However, my /etc/conf.d/net looks like this:

```

#eth1

modules=("iwconfig")

modules=( "wpa_supplicant" )

#Users of madwifi add:

# wpa_supplicant_ath0="-Dmadwifi"

#Users of Intel ipw2100/2200 (Centrino) chips with older kernels add...

# wpa_supplicant_ath0="-Dipw"

# wpa_timeout_ath0=60

# As of kernel 2.6.15 centrino users should use...

wpa_supplicant_eth1="-Dwext"

wpa_timeout_eth1=60

iface_eth1="dhcp"

```

Using the wext driver because the HOWTO said to, since my kernel is new.

Here's my /etc/wpa_supplicant.conf:

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

eapol_version=1

ap_scan=2

fast_reauth=1

# Only WPA-PSK is used. Any valid cipher combination is accepted.

network={

        ssid="foo"

        scan_ssid=1

        proto=WPA

        key_mgmt=WPA-PSK

        pairwise=TKIP

        group=TKIP

        psk=(obscured, generated with wpa_passphrase)

}

```

This is what happens when i run wpa_supplicant.

```

SIOCGIWRANGE: WE(compiled)=19 WE(source)=16 enc_capa=0x0

  capabilities: key_mgmt 0x0 enc 0x3

Own MAC address: 00:13:ce:87:22:63

wpa_driver_hostap_set_wpa: enabled=1

wpa_driver_hostap_set_key: alg=none key_idx=0 set_tx=0 seq_len=0 key_len=0

ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported

Failed to set encryption.

wpa_driver_hostap_set_key: alg=none key_idx=1 set_tx=0 seq_len=0 key_len=0

ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported

Failed to set encryption.

wpa_driver_hostap_set_key: alg=none key_idx=2 set_tx=0 seq_len=0 key_len=0

ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported

Failed to set encryption.

wpa_driver_hostap_set_key: alg=none key_idx=3 set_tx=0 seq_len=0 key_len=0

ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported

Failed to set encryption.

```

The two big questions I have are why it's complaining about PRISM2_IOCTL_HOSTAPD.  I'm pretty sure the ipw2200 isn't a prism based chip, and I know others on this forum have successfully used it with WPA.  The second question is why I'm seeing 

```
wpa_driver_hostap_set_key 
```

 instead of 

```
wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0 
```

.

Any ideas?

(p.s. dmesg says this)

```

atkbd.c: Keyboard on isa0060/serio0 reports too many keys pressed.

ipw2200: Unknown notification: subtype=40,flags=0xa0,size=40

ipw2200: Unknown notification: subtype=40,flags=0xa0,size=40

ipw2200: Unknown notification: subtype=40,flags=0xa0,size=40

ipw2200: Unknown notification: subtype=40,flags=0xa0,size=40

```

----------

## r4di0_h34d

Okay.  I feel like a moron, but I found the answer to my two questions.  I've been following everyone example running wpasupplicant "by hand" from the command line.  I've been neglecting to pass in the -Dwext option to specify the driver my card needs.  Running wpa_supplicant with -D wext makes things happen.  Unfortunately, they're still not what I want.  wap_supplicant never finishes, but I do see network activity in my network monitor widget.  Also iwconfig reports that my wireless interface is associated with the right ssid.

Here's some output from wpa_supplicant that might shed some light on the problem.  wpa_supplicant appears to loop infinitely, this is the section that seems to break the handshake and start everything over.

```

State: GROUP_HANDSHAKE -> GROUP_HANDSHAKE

WPA: RX message 1 of Group Key Handshake from 00:0c:e5:4a:5b:3b (ver=1)

WPA: Unsupported TKIP Group Cipher key length 5 (5).

Wireless event: cmd=0x8b15 len=20

Wireless event: new AP: 00:00:00:00:00:00

Setting scan request: 0 sec 100000 usec

BSSID 00:0c:e5:4a:5b:3b blacklist count incremented to 8

State: GROUP_HANDSHAKE -> DISCONNECTED

EAPOL: External notification - portEnabled=0

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: SUPP_BE entering state INITIALIZE

EAPOL: External notification - portValid=0

EAPOL: External notification - EAP success=0

CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys

wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth1' added

Wireless event: cmd=0x8b15 len=20

Wireless event: new AP: 00:00:00:00:00:00

BSSID 00:00:00:00:00:00 blacklist count incremented to 8

State: DISCONNECTED -> DISCONNECTED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

EAPOL: External notification - EAP success=0

CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys

wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

State: DISCONNECTED -> SCANNING

Trying to associate with SSID 'foo'

Cancelling scan request

WPA: clearing own WPA/RSN IE

```

----------

## r4di0_h34d

Okay, finally, simplifying /etc/wpa_supplicant.conf did the trick.  I'm posting this with my ethernet cable disconnected.  Here are the final working versions of the two important files.

/etc/conf.d/net

```

#eth1

config_eth1=( "dhcp" )

dhcpcd_eth1="-t 20"

#iwconfig_eth1="foo" #only for hidden ESSID

modules_eth1=( "wpa_supplicant" )

# As of kernel 2.6.15 centrino users should use...

wpa_supplicant_eth1="-Dwext"  

# Before kernel 2.6.12-r10 should use...

#wpa_supplicant_eth1="-dd -Dipw"

#wpa_timeout_eth1=10

```

/etc/wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

eapol_version=1

ap_scan=1

fast_reauth=1

# Only WPA-PSK is used. Any valid cipher combination is accepted.

network={

        ssid="foo"

        scan_ssid=1

        #key_mgmt=WPA-PSK

        #pairwise=TKIP

        #group=TKIP

        psk=(obscured)

}

```

I'm using kernel 2.6.15-r1 with built in iwp2200 driver module, udev 89-r1, and ipw2200-firmware 2.4.

----------

