# Problems connecting to WPA2-PSK AP

## guinness.stout

Well I have read http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&chap=4 as well as http://gentoo-wiki.com/HOWTO_Wireless_Configuration_and_Startup and man wpa_supplicant.  Everything appears to be working but I can never connect to my wireless router.

The router is

WPA2-PSK

TKIP-AES

WPA Shared Key

/etc/wpa_supplicant/wpa_supplicant.conf

```

# This is a network block that connects to any unsecured access point.

# We give it a low priority so any defined blocks are preferred.

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

network={

        ssid="zepher"

        proto=WPA2

        pairwise=TKIP

        group=TKIP

        key_mgmt=WPA-PSK

        psk="very secret key"

}

```

/etc/conf.d/net

```

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

HOSTNAME="overflow"

dns_domain_lo="eip.gov"

config_eth0=( "dhcp" )

essid_wlan0="zepher"

config_wlan0=( "dhcp" )

modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="ndiswrapper"

```

I also followed the direction in the docs I read so I did 

```

cd /etc/init.d

ln -s net.lo net.wlan0

/etc/init.d/net.wlan0 start

```

/etc/init.d/net.wlan0 start

```

* Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...                                 [ ok ]

 *   Starting wpa_cli on wlan0 ...                                        [ ok ]

 *     Backgrounding ...

```

iwconfig

```

lo        no wireless extensions.

eth0      no wireless extensions.

sit0      no wireless extensions.

wlan0     IEEE 802.11g  ESSID:off/any

          Mode:Managed  Frequency:2.462 GHz  Access Point: Not-Associated

          Bit Rate:54 Mb/s   Tx-Power:24 dBm

          RTS thr:2347 B   Fragment thr:2346 B

          Encryption key:off

          Power Management: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

```

I can't seem to find the step I missed.

----------

## massimo

 *guinness.stout wrote:*   

> Well I have read http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&chap=4 as well as http://gentoo-wiki.com/HOWTO_Wireless_Configuration_and_Startup and man wpa_supplicant.  Everything appears to be working but I can never connect to my wireless router.
> 
> The router is
> 
> WPA2-PSK
> ...

 

You probably need to change the config of the network to look like this:

```

network={

        ssid="zepher"

        proto=RSN

        pairwise=TKIP

        group=TKIP

        key_mgmt=WPA-PSK

        psk="very secret key"

}

```

What gives you iwlist scan?

----------

## guinness.stout

iwlist scan before and after the change you suggested gives me

```

wlan0 No scan results

```

----------

## massimo

Add scan_ssid=1 to the network configuration of zepher and try again. If this does not work try debugging by executing wpa_supplicant manually, e.g.,

```

# wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d

```

----------

## guinness.stout

Do I need to properly terminate special charactures in my key if my key was say "thisismykey!" minus the quotations.  Do I need to put a \ (backslash) infront of the exclamation mark like "thisismykey\!"?

I let that command run for a few seconds.  As you can see it is not finding an AP.  I am also confused why it does not say WPA2.  AP I am connecting to is WPA2-PSK only.

```

wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -d

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

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

Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group='0' (DEPRECATED)

ap_scan=1

Priority group 0

   id=0 ssid='zepher'

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)=22 WE(source)=18 enc_capa=0xf

  capabilities: key_mgmt 0xf enc 0xf

WEXT: Operstate: linkmode=1, operstate=5

Own MAC address: 00:1a:73:b6:11:6f

wpa_driver_wext_set_wpa

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_countermeasures

wpa_driver_wext_set_drop_unencrypted

Setting scan request: 0 sec 100000 usec

ctrl_interface_group=0

Added interface wlan0

RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()

Wireless event: cmd=0x8b06 len=12

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

State: DISCONNECTED -> SCANNING

Starting AP scan (specific SSID)

Scan SSID - hexdump_ascii(len=6):

     7a 65 70 68 65 72                                 zepher

Trying to get current scan results first without requesting a new scan to speed up initial association

Received 0 bytes of scan results (0 BSSes)

Scan results: 0

Selecting BSS from priority group 0

Try to find WPA-enabled AP

Try to find non-WPA AP

No suitable AP found.

Setting scan request: 0 sec 0 usec

Starting AP scan (broadcast SSID)

Scan timeout - try to get results

Received 0 bytes of scan results (0 BSSes)

Scan results: 0

Selecting BSS from priority group 0

Try to find WPA-enabled AP

Try to find non-WPA AP

No suitable AP found.

Setting scan request: 5 sec 0 usec

Starting AP scan (specific SSID)

Scan SSID - hexdump_ascii(len=6):

     7a 65 70 68 65 72                                 zepher

Scan timeout - try to get results

Received 0 bytes of scan results (0 BSSes)

Scan results: 0

Selecting BSS from priority group 0

Try to find WPA-enabled AP

Try to find non-WPA AP

No suitable AP found.

Setting scan request: 5 sec 0 usec

Starting AP scan (broadcast SSID)

CTRL-EVENT-TERMINATING - signal 2 received

Removing interface wlan0

State: SCANNING -> DISCONNECTED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

WEXT: Operstate: linkmode=-1, operstate=5

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

wpa_driver_wext_set_wpa

wpa_driver_wext_set_drop_unencrypted

wpa_driver_wext_set_countermeasures

No keys have been configured - skip key clearing

Cancelling scan request

Cancelling authentication timeout

WEXT: Operstate: linkmode=0, operstate=6

```

----------

## h0tline

Did you add 

wpa_supplicant_wlan0="-Dwext" # For generic wireless

or

wpa_supplicant_wlan0="-Dmadwifi" # For Atheros based cards

My computer has madwifi so I had to supply this.  See "man wpa_supplicant" ... what driver do you use anyway?

----------

## guinness.stout

I am using bcmwl5.inf which I use with ndiswrapper so mine reads

wpa_supplicant_wlan0="ndiswrapper"

----------

## massimo

Give it a shot with wpa_supplicant_wlan0="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf ".

----------

## guinness.stout

I don't understand the command you want me to run.

----------

## massimo

Change the according line in your /etc/conf.d/net configuration file to 

```
wpa_supplicant_wlan0="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf"
```

 and try to restart, e.g., 

```
# /etc/init.d/net.wlan0 restart
```

----------

## guinness.stout

Same result, nothing.

----------

## massimo

 *guinness.stout wrote:*   

> 
> 
> /etc/conf.d/net
> 
> ```
> ...

 

You could put the following lines in this file too:

```

preferred_aps=( "zepher" )

associate_order="preferredonly"

```

Run manually wpa_supplicant and tell us the debugging output.

----------

## guinness.stout

Good lord, still nothing.  I've never had this much trouble with WIFI before.  Let me recap all my configs since I've made a lot of changes now.

/etc/conf.d/net

```

dns_domain_lo="eip.gov"

config_eth0=( "dhcp" )

#dhcp_eth0="nodns nontp nonis"

essid_wlan0="zepher"

config_wlan0=( "dhcp" )

modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf"

preferred_aps=( "zepher" )

accociate_order="preferredonly"

```

/etc/wpa_supplicant/wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

network={

        ssid="zepher"

        proto=RSN

        pairwise=TKIP

        group=TKIP

        key_mgmt=WPA-PSK

        psk="keycode!"

        scan_ssid=1

}

```

wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -d

```

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

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

Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group='0' (DEPRECATED)

ap_scan=1

Priority group 0

   id=0 ssid='zepher'

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)=22 WE(source)=18 enc_capa=0xf

  capabilities: key_mgmt 0xf enc 0xf

WEXT: Operstate: linkmode=1, operstate=5

Own MAC address: 00:1a:73:b6:11:6f

wpa_driver_wext_set_wpa

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_countermeasures

wpa_driver_wext_set_drop_unencrypted

Setting scan request: 0 sec 100000 usec

ctrl_interface_group=0

Added interface wlan0

RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()

Wireless event: cmd=0x8b06 len=12

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

State: DISCONNECTED -> SCANNING

Starting AP scan (specific SSID)

Scan SSID - hexdump_ascii(len=6):

     7a 65 70 68 65 72                                 zepher

Trying to get current scan results first without requesting a new scan to speed up initial association

Received 0 bytes of scan results (0 BSSes)

Scan results: 0

Selecting BSS from priority group 0

Try to find WPA-enabled AP

Try to find non-WPA AP

No suitable AP found.

Setting scan request: 0 sec 0 usec

Starting AP scan (broadcast SSID)

Scan timeout - try to get results

Received 0 bytes of scan results (0 BSSes)

Scan results: 0

Selecting BSS from priority group 0

Try to find WPA-enabled AP

Try to find non-WPA AP

No suitable AP found.

Setting scan request: 5 sec 0 usec

CTRL-EVENT-TERMINATING - signal 2 received

Removing interface wlan0

State: SCANNING -> DISCONNECTED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

WEXT: Operstate: linkmode=-1, operstate=5

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

wpa_driver_wext_set_wpa

wpa_driver_wext_set_drop_unencrypted

wpa_driver_wext_set_countermeasures

No keys have been configured - skip key clearing

Cancelling scan request

Cancelling authentication timeout

WEXT: Operstate: linkmode=0, operstate=6

```

----------

## swimmer

Add 'CCMP' to both 'group' and 'pairwise' (without removing TKIP!) and see if that helps ...

Greetz

swimmer

----------

## guinness.stout

Add it in what way?

I did 

```

pairwise=TKIP-CCMP

group=TKIP-CCMP

```

I try to run wpa_supplicant manually and I get invalid cipher errors.

UPDATE

change it to TKIP CCMP, removed the hyphen as per the README on the wpa_supplicant website.  Again, nothing.  Still not working.

----------

## swimmer

Hmpf :-/ Ok then, the last thing I can possible help is adding 'WPA' to 'proto' as in 

```
proto=WPA RSN
```

HTH

swimmer

----------

## guinness.stout

Still nothing.

----------

## swimmer

Hmm - and your router has a fixed channel? Otherwise you could try that as well since I experienced problems with automatic channel selection ...

HTH

swimmer

----------

## guinness.stout

Yes, it is fixed on channel 6.

----------

## tarpman

```
wpa_cli scan && sleep 2 && wpa_cli scan_results
```

The wpa_supplicant output says it can't see your AP at all.  Let's see if that's actually the case.  Note that wpa_supplicant needs to be running (i.e. net.wlan0 needs to be started or starting) for the above commands to work.

What is your wireless device?  What driver exactly are you using for it?

----------

## guinness.stout

wpa_cli scan && sleep 2 && wpa_cli scan_results

```

Selected interface 'wlan0'

OK

Selected interface 'wlan0'

```

----------

