# Connecting to WPA access point, wpa_supplicant

## avkhatri

Hey everyone,

I recently got a new ISP, new router, and new passcode and I am having trouble connecting wirelessly to the router via wpa_supplicant. Before I switched to the new ISP we had a ten digit wep key and I was easily able to connect to the internet with these simple commands

```

ifconfig wlan0 up

iwconfig wlan0 mode managed key 1234567890

iwconfig wlan0 essid "2WIRE650"

dhcpcd wlan0

```

The new network uses a WPA personal key with a string of letters and numbers and will not work with the commands above. I've configured wpa_supplicant and my /etc/conf.d/net. (I've also tried the GUIs wicd and NetworkManager and they will just hang while attempting to connect and then fail) 

However, when I run

```
wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf
```

This error loops

```
Trying to associate with e0:91:f5:0c:6f:fd (SSID='My-PC-Wireless' freq=2412 MHz)

Associated with e0:91:f5:0c:6f:fd

WPA: Key negotiation completed with e0:91:f5:0c:6f:fd [PTK=CCMP GTK=TKIP]

CTRL-EVENT-CONNECTED - Connection to e0:91:f5:0c:6f:fd completed (auth) [id=0 id_str=]

```

My wpa_supplicant looks like this: 

```
#Generated by NetworkManager

###### Global Configuration ######

ctrl_interface_group=0

ctrl_interface=/var/run/wpa_supplicant

ap_scan=1

###### Security Configuration ######

network={

   ssid="My-PC-Wireless"

   psk="thisismynewpasscode112010"

   priority=5

   }

```

I've noticed the line:

"ctrl_interface_group=/var/run/wpa_supplicant" 

however there is no folder or file in /var/run/ that is "wpa_supplicant" 

My /etc/conf.d/net file looks like this (I actually made this from an example from another forum post which I cant seem to dig up again right now)

```
#Generated by NetworkManager

###### Global Configuration ######

#wpa_supplicant_wlan0="-Dwext"

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

modules=( "wpa_supplicant" )

###### Connection Configuration ######

#----------------------------------

#config_eth0=( "dhcp" )

iface wlan0 inet dhcp

wireless-essid My-PC-Wireless

wireless-key 4491fb9facd85bad415b8bd69a6537bf857453a7bb9716d420dca076db186d11

wpa-driver wext

wpa-essid My-PC-Wireless

wpa-psk 4491fb9facd85bad415b8bd69a6537bf857453a7bb9716d420dca076db186d11

```

----------

## DONAHUE

I would unmerge wicd and network manager, (asuming your wireless interface is named wlan0, ), run 

```
iwlist scan
```

 to gather network parameters, then check that 

```
ls -l /etc/init.d/net.*
```

  includes symlink /etc/init.d/net.wlan0 -> net.lo

Edit /etc/conf.d/net to *Quote:*   

> modules_wlan0=( "wpa_supplicant" )
> 
> wpa_supplicant_wlan0="-Dwext"
> 
> wpa_timeout_wlan0=15
> ...

 Edit /etc/wpa_supplicant/wpa_supplicant to:

method 1: 

(If you have wpa_gui)Enter the following: *Quote:*   

> ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
> 
> update_config=1
> 
> 

 Then use wpa_gui to configure your network.

method 2: ( If unwilling or unable to use wpa_gui) *Quote:*   

> ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
> 
> update_config=1
> 
> network={
> ...

 

The psk= entry usually requires the parentheses for 8 character code and not for the character key. but i think that may vary based  on nic/router

----------

## avkhatri

Donahue,

Running

```
 ls -l /etc/init.d/net.*
```

gives me

```

/etc/init.d/net.eth0 -> net.lo

/etc/init.d/net.lo

```

But nothing that says 

/etc/init.d/net.wlan0 -> net.lo. 

How can I add that in? I opened the file in nano, but I don't know what to do with all that syntax haha.

I've edited the files as per your original post and used method 2. However, I am getting a different CTRL EVENT DISCONNECTED error

```

Trying to associate with e0:91:f5:0c:6f:fd (SSID='My-PC-Wireless' freq=2412MHz)

Associated with  e0:91:f5:0c:6f:fd

WPA: 4-Way Handshake failed - pre-shared key may be incorrect

```

I'm sure my key has been typed correctly though

----------

## DONAHUE

The psk= entry usually requires the quotes for 8 character code and not for the 64 character key. but i think that may vary based on nic/router. you might try psk= with and without quotes.

misspoke before with parentheses, sorry.

Your wireless interface is named wlan0? Then:

```
cd /etc/init.d

ln -s net.lo net.wlan0

rc-update add net.wlan0 default

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

does dmesg show dhcp events working correctly?

----------

## avkhatri

Donahue, after using the commands provided

```

cd /etc/init.d 

ln -s net.lo net.wlan0 

rc-update add net.wlan0 default 

/etc/init.d/net.wlan0 restart

```

My desktop connects to the internet at boot! Thank you so much for your help.

----------

## DONAHUE

well done

----------

## HeXiLeD

I am having a similar problem.

I have checked other forum topics and example configurations and at best what can get is "Bad password".

i tried with cli wpa configurations, wicd with wicd-curses and gtk and it never connects.

However with another distro that i have in the same netbook, it works right away. I also used that distros config files with gentoo and still no solution.

I am very lost. The other distro uses the same wireless driver and setup.

The network i can trying to connect is :

```
# iwlist eth1 scan

eth1      Scan completed :

          Cell 01 - Address: 38:22:9D:A0:47:A0

                    ESSID:"name"

                    Mode:Managed

                    Frequency:2.437 GHz (Channel 6)

                    Quality:3/5  Signal level:-68 dBm  Noise level:-91 dBm

                    IE: Unknown: 

DDAA0050F204104A00011010440001021041000100103B000103104700100000000000000001000338229DA047A010210013506972656C6C6920436F72706F726174696F6E1023000B502E44472041313030304710240019302E39392E313962312D50545F54523036395F416E6E65784D1042000D323439303159303033373734331054000800060050F204000110110014576972656C65737320526F757465722857464129100800020004

                    IE: WPA Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (1) : TKIP

                        Authentication Suites (1) : PSK

                    Encryption key:on

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 9 Mb/s

                              18 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 12 Mb/s

                              24 Mb/s; 48 Mb/s
```

I have done and redone /etc/conf.d/net as well as wpa_suppliant.conf and even used this topic as an example. I am using the broadcom-sta wl driver and for both distros. My last try complained about the PSK which no matter how i set it up; the result was the same.

Any tips or ideas about how to connect to this AP ?

----------

## DONAHUE

are you using baselayout1 or baselayout2 and openrc?

Pls post results of:

```
cat /etc/conf.d/net

ls -l /etd/init.d/net*

cat /etc/wpa_supplicant/wpa_supplicant.conf

ifconfig

lspci -k

ls -l /lib/firmware
```

----------

