# wpa_supplicant with dlink di-524

## nszeek

I am trying to connect to a wireless router with my notebook and I keep getting the error below:

```

Trying to associate with aa:bb:cc:dd:ee:ff (SSID='some-wireless-network' freq=2452 MHz)

Associated with aa:bb:cc:dd:ee:ff

CTRL-EVENT-DISCONNECTED bssid=aa:bb:cc:dd:ee:ff reason=0

```

This error message keeps looping for as long as I let wpa_supplicant run.

Here are some more details:

```

$ iwlist wlan0 scan essid some-wireless-network | head -n34

wlan0     Scan completed :

          Cell 01 - Address: aa:bb:cc:dd:ee:ff

                    Channel:9

                    Frequency:2.452 GHz (Channel 9)

                    Quality=70/70  Signal level=-39 dBm  

                    Encryption key:on

                    ESSID:"some-wireless-network"

                    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

                    Bit Rates:6 Mb/s; 12 Mb/s; 24 Mb/s; 48 Mb/s

                    Mode:Master

                    Extra:tsf=00000001dfc4514f

                    Extra: Last beacon: 2008ms ago

                    IE: Unknown: 000D616572616E776972656C657373

                    IE: Unknown: 010882848B961224486C

                    IE: Unknown: 030109

                    IE: Unknown: 2A0100

                    IE: Unknown: 32040C183060

                    IE: Unknown: 2D1AEE1117FF000000010000000000000000000000000C0000000000

                    IE: Unknown: 3D1609070000000000000000000000000000000000000000

                    IE: Unknown: 3E0100

                    IE: WPA Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (2) : TKIP CCMP

                        Authentication Suites (1) : PSK

                    IE: IEEE 802.11i/WPA2 Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (2) : TKIP CCMP

                        Authentication Suites (1) : PSK

                    IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00

                    IE: Unknown: 7F0101

                    IE: Unknown: DD07000C4307000000

                    IE: Unknown: DD1E00904C33EE1117FF000000010000000000000000000000000C0000000000

                    IE: Unknown: DD1A00904C3409070000000000000000000000000000000000000000

```

The entry from /etc/wpa_supplicant/wpa_supplicant.conf:

```

ctrl_interface_group=0

ap_scan=1

network={

  ssid="some-wireless-network"

  psk="password"                                                                                                                                                                                        

  priority=5

}

```

I also used to following configurations with wpa_supplicant.conf (each at a time):

```

network={

        ssid="some-wireless-network"

        proto=WPA

        key_mgmt=WPA-PSK

        pairwise=CCMP TKIP

        group=CCMP TKIP WEP104 WEP40

        psk="password"

        priority=1027

}

network={

        ssid="some-wireless-network"

        proto=RSN

        key_mgmt=WPA-PSK

        pairwise=CCMP TKIP

        group=CCMP TKIP WEP104 WEP40

        psk="password"

        priority=1028

}

```

This is the relevant configuration from the /etc/conf.d/net file:

```

modules_wlan0="wpa_supplicant"

config_wlan0="dhcp"

iwconfig_wlan0="txpower on"

wpa_supplicant_wlan0="-Dwext"

```

The router is configured to use channel 9 with WPA-PSK/WPA2-PSK and a password. This is all the router (D-Link DI-524) will let me configure.

The output of dmesg | tail after the error described above is:

```

[ 3955.270725] wlan0: authenticate with aa:bb:cc:dd:ee:ff (try 1)

[ 3955.272578] wlan0: authenticated

[ 3955.272629] wlan0: associate with aa:bb:cc:dd:ee:ff (try 1)

[ 3955.276422] wlan0: RX AssocResp from aa:bb:cc:dd:ee:ff (capab=0x431 status=0 aid=1)

[ 3955.276427] wlan0: associated

[ 3959.002314] wlan0: deauthenticated from aa:bb:cc:dd:ee:ff (Reason: 3)

```

From the router I get the following message:

```

Associated: <my mac address> st=0

Disassociated: <my mac address> because WPA retey failed 4

```

I couldn't find anything in /var/log/syslog (with tail -n200 | grep -i wpa and with tail -n200 | grep -i wlan0).

Other than that I already tried to use ap_scan=0 and ap_scan=1 (also didn't work). I also configured the router to use static IP addresses (with MAC binding) which didn't work.

I can connect with my nokia n900 (using maemo) without problems and I can also connect using a friend's notebook (with Windows). I am also sure that my hardware is working since I can connect to my home router using this machine with WPA or WPA2. 

On a last note, I cannot upgrade the router's firmware since I don't own it and the person who does did not give me authorization.

----------

## gerdesj

I'm afraid I can't be of too much help with specifics but the following works with everything I've encountered with my laptop in the UK, Spain, Italy, Czech Republic, Germany etc etc!

I have an Intel IWLAGN card.  I compile the driver as a module and also put the firmware into the kernel.  I use dhcpcd.

Notice I don't specify anything apart from the SSID and PSK - wpa_supplicant is _very_ good at doing the complex stuff like working out what protocols to use.

```

# /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

eapol_version=1

ap_scan=1

fast_reauth=1

country=GB

network={

        ssid="my home ssid"

        psk="my home psk"

}

```

```

# /etc/conf.d/net 

modules="dhcpcd

         iproute2"

wpa_supplicant_wlan0="-Dwext"

config_wlan0="dhcp"

```

I notice you have iwconfig related stuff in there.  I've never used that, on this nor my last laptop.

Hope this helps in some way.

Cheers

Jon

PS country=GB is probably wrong for you and has certainly never helped me as such.  My Draytek WiFi seems to force "TK"!

----------

## nszeek

Thanks for the reply gerdesj.

I already tried that (using just the essid and password to connect) but it didn't work. I made a few calls and turns out the firmware from the DI-524 is not working correctly. I will just buy a new one and keep away from D-Link stuff.

----------

## gerdesj

Other devices work which generally implies that they support some form of MS bodge in general.

Oh well, if you are going for another bridge then best of luck.

If it helps:

I generally find Netgear pretty standards compliant and reasonably priced - I've used around 10 of these recently. 

I have sold/use around 50 odd Draytek ADSL n WiFi routers (rather pricey but stable) and their WiFi is very good - I use one at home - I only reboot for updates.  They do a couple of AP only boxes as well - they will probably be good.

Cheers

Jon

----------

