# Ralink Wifi Card Troubles



## holms (Nov 28, 2008)

Hello,

I have a problem with my wifi card. I tried almost everything that was possible anyway here what I got.

The card is: D-link DAW5100


```
ral0@pci0:0:16:0:       class=0x028000 card=0x3a711186 chip=0x03021814 rev=0x00 hdr=0x00
    vendor     = 'Ralink Technology, Corp'
    device     = 'RT2525 2.4GHz transceiver + RT2560 MAC/BBP wireless a/b'
    class      = network
```

all ifconfig list scan and up scan is working fine


```
server# ifconfig ral0 up scan
SSID            BSSID              CHAN RATE   S:N     INT CAPS
holmsap         00:1e:58:bf:ee:f5    6   54M -94:-95  100 EPS  WPA WME ATH
```

dhcpclient is not working writing 'no link'


```
wpa_supplicant -i ral0 -c /etc/wpa_supplicant.conf -d
```

gives this:


```
State: DISCONNECTED -> SCANNING
Trying to associate with SSID 'holmsap'
Cancelling scan request
WPA: clearing own WPA/RSN IE
Automatic auth_alg selection: 0x1
wpa_driver_bsd_set_auth_alg alg 0x1 authmode 1
WPA: No WPA/RSN IE available from association info
WPA: Set cipher suites based on configuration
WPA: Selected cipher suites: group 30 pairwise 24 key_mgmt 3 proto 2
WPA: clearing AP WPA IE
WPA: clearing AP RSN IE
WPA: using GTK CCMP
WPA: using PTK CCMP
WPA: using KEY_MGMT 802.1X
WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 01 00 00
No keys have been configured - skip key clearing
wpa_driver_bsd_set_drop_unencrypted: enabled=1
State: SCANNING -> ASSOCIATING
wpa_driver_bsd_associate: ssid 'holmsap' wpa ie len 22 pairwise 3 group 3 key mgmt 0
wpa_driver_bsd_associate: set PRIVACY 1
ioctl[SIOCS80211, op 21, len 42]: Invalid argument
Association request to the driver failed
Setting authentication timeout: 5 sec 0 usec
EAPOL: External notification - portControl=Auto
```

as you can see some  kind of argument is invalid in there =/

my /etc/wpa_supplicant.conf


```
ap_scan=2

network={
        ssid="holmsap"
        #psk="b98huDra"
        psk=50f6decc673ab8178bc26d616b071e0503e2118a908ec2cef754032a1b36210a
}
```

I googled that ap_scan=2 can help.. anyway without it I guess it could be another dump =) so here's dump with ap_scan=1


```
server# wpa_supplicant -i ral0 -c /etc/wpa_supplicant.conf -d
Initializing interface 'ral0' conf '/etc/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
ap_scan=1
Priority group 0
   id=0 ssid='holmsap'
Initializing interface (2) 'ral0'
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
Own MAC address: 00:1e:58:9a:e6:d1
wpa_driver_bsd_set_wpa: enabled=1
wpa_driver_bsd_set_wpa_internal: wpa=3 privacy=1
wpa_driver_bsd_del_key: keyidx=0
wpa_driver_bsd_del_key: keyidx=1
wpa_driver_bsd_del_key: keyidx=2
wpa_driver_bsd_del_key: keyidx=3
wpa_driver_bsd_set_countermeasures: enabled=0
wpa_driver_bsd_set_drop_unencrypted: enabled=1
Setting scan request: 0 sec 100000 usec
Added interface ral0
State: DISCONNECTED -> SCANNING
Starting AP scan (broadcast SSID)
Trying to get current scan results first without requesting a new scan to speed up initial association
Received 0 bytes of scan results (1 BSSes)
Scan results: 1
Selecting BSS from priority group 0
Try to find WPA-enabled AP
0: 00:1e:58:bf:ee:f5 ssid='holmsap' wpa_ie_len=24 rsn_ie_len=0 caps=0x31
   selected based on WPA IE
   selected WPA AP 00:1e:58:bf:ee:f5 ssid='holmsap'
Try to find non-WPA AP
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
Cancelling scan request
WPA: clearing own WPA/RSN IE
Automatic auth_alg selection: 0x1
wpa_driver_bsd_set_auth_alg alg 0x1 authmode 1
WPA: using IEEE 802.11i/D3.0
WPA: Selected cipher suites: group 16 pairwise 16 key_mgmt 2 proto 1
WPA: set AP WPA IE - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02
WPA: clearing AP RSN IE
WPA: using GTK CCMP
WPA: using PTK CCMP
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 04 01 00 00 50 f2 04 01 00 00 50 f2 02
No keys have been configured - skip key clearing
wpa_driver_bsd_set_drop_unencrypted: enabled=1
State: SCANNING -> ASSOCIATING
wpa_driver_bsd_associate: ssid 'holmsap' wpa ie len 24 pairwise 3 group 3 key mgmt 1
wpa_driver_bsd_associate: set PRIVACY 1
Setting authentication timeout: 10 sec 0 usec
EAPOL: External notification - EAP success=0
EAPOL: External notification - EAP fail=0
EAPOL: External notification - portControl=Auto
Authentication with 00:00:00:00:00:00 timed out.
Added BSSID 00:1e:58:bf:ee:f5 into blacklist
No keys have been configured - skip key clearing
State: ASSOCIATING -> DISCONNECTED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
EAPOL: External notification - EAP success=0
Setting scan request: 0 sec 0 usec
State: DISCONNECTED -> SCANNING
Starting AP scan (broadcast SSID)
Received 0 bytes of scan results (1 BSSes)
Scan results: 1
Selecting BSS from priority group 0
Try to find WPA-enabled AP
0: 00:1e:58:bf:ee:f5 ssid='holmsap' wpa_ie_len=24 rsn_ie_len=0 caps=0x31
   selected based on WPA IE
   selected WPA AP 00:1e:58:bf:ee:f5 ssid='holmsap'
Try to find non-WPA AP
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
Cancelling scan request
WPA: clearing own WPA/RSN IE
Automatic auth_alg selection: 0x1
wpa_driver_bsd_set_auth_alg alg 0x1 authmode 1
WPA: using IEEE 802.11i/D3.0
WPA: Selected cipher suites: group 16 pairwise 16 key_mgmt 2 proto 1
WPA: set AP WPA IE - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 04 01 00 00 50 f2 04 01 00 00 50 f2 02
WPA: clearing AP RSN IE
WPA: using GTK CCMP
WPA: using PTK CCMP
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 04 01 00 00 50 f2 04 01 00 00 50 f2 02
No keys have been configured - skip key clearing
wpa_driver_bsd_set_drop_unencrypted: enabled=1
State: SCANNING -> ASSOCIATING
wpa_driver_bsd_associate: ssid 'holmsap' wpa ie len 24 pairwise 3 group 3 key mgmt 1
wpa_driver_bsd_associate: set PRIVACY 1
Setting authentication timeout: 10 sec 0 usec
EAPOL: External notification - EAP success=0
EAPOL: External notification - EAP fail=0
EAPOL: External notification - portControl=Auto
Authentication with 00:00:00:00:00:00 timed out.
BSSID 00:1e:58:bf:ee:f5 blacklist count incremented to 2
No keys have been configured - skip key clearing
State: ASSOCIATING -> DISCONNECTED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
EAPOL: External notification - EAP success=0
Setting scan request: 0 sec 0 usec
State: DISCONNECTED -> SCANNING
Starting AP scan (broadcast SSID)
^CCTRL-EVENT-TERMINATING - signal 2 received
Removing interface ral0
State: SCANNING -> DISCONNECTED
No keys have been configured - skip key clearing
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
wpa_driver_bsd_set_wpa: enabled=0
wpa_driver_bsd_set_wpa_internal: wpa=0 privacy=0
wpa_driver_bsd_set_drop_unencrypted: enabled=0
wpa_driver_bsd_set_countermeasures: enabled=0
No keys have been configured - skip key clearing
Removed BSSID 00:1e:58:bf:ee:f5 from blacklist (clear)
Cancelling scan request
Cancelling authentication timeout
wpa_driver_bsd_set_wpa_internal: wpa=3 privacy=1
```



I tried to use Windows drivers but kldload says operations permitted.. btw all wlan stuff and ral module is compiled in to kernel here's my kernel configuration:


```
# Wireless NIC cards
device          wlan            # 802.11 support
device          wlan_wep        # 802.11 WEP support
device          wlan_ccmp       # 802.11 CCMP support
device          wlan_tkip       # 802.11 TKIP support
device          wlan_amrr       # AMRR transmit rate control algorithm
device          wlan_scan_ap    # 802.11 AP mode scanning
device          wlan_scan_sta   # 802.11 STA mode scanning
device          an              # Aironet 4500/4800 802.11 wireless NICs.
device          ath             # Atheros pci/cardbus NIC's
device          ath_hal         # Atheros HAL (Hardware Access Layer)
device          ath_rate_sample # SampleRate tx rate control for ath
device          awi             # BayStack 660 and others
device          ral             # Ralink Technology RT2500 wireless NICs.
device          wi              # WaveLAN/Intersil/Symbol 802.11 wireless NICs.
#device         wl              # Older non 802.11 Wavelan wireless NIC.
```

and here's rc.conf 


```
ifconfig_ral0="DHCP ssid holms_wifi authmode wpa"
```

Tried billions of variants with rc.conf, without dhcp, or with... nothing works.. =/


Please help =(


----------



## marius (Nov 28, 2008)

My wpa_supplicant.conf looks similar to yours, but my rc.conf contains this line instead.


```
ifconfig_iwi0="WPA DHCP"
```

If your ssid is holmsap, why do you use holms_wifi in rc.conf?

If this doesn't solve the problem, try to kill the wpa_supplicant and start with the basics, no encryption, just an open network.


----------



## holms (Nov 28, 2008)

mm thnx for quick reply, I set rc.conf like yours, still dhcpclient shows 'no link', I guess I'll start with basic tomorow or this night, and try go step by step with handbook in this thread, so that anybody could help.. =)


----------



## marius (Nov 28, 2008)

Does it make any difference if you add " " around the key?


```
psk="50f6decc673ab8178bc26d616b071e0503e2118a908ec2cef754032a1b36210a"
```


----------



## holms (Nov 28, 2008)

it does =) in " " it will be ASCI chars, and here's HEX.

I mean :


```
server# wpa_passphrase holmsap b98huDra
network={
        ssid="holmsap"
        #psk="b98huDra"
        psk=70f6228c10ae78868dfd7d6facd913a5949004af01cd2f98a7563ba4c2c56a95
}
```

ok so now I'll try to re-setup everything.


----------



## holms (Nov 28, 2008)

hmz now it's tottally something new:


```
server# wpa_supplicant -i ral0 -c /etc/wpa_supplicant.conf
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
WPA: No SSID info found (msg 1 of 4).
Authentication with 00:00:00:00:00:00 timed out.
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
Authentication with 00:00:00:00:00:00 timed out.
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
Authentication with 00:00:00:00:00:00 timed out.
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
Associated with 00:1e:58:bf:ee:f5
WPA: Key negotiation completed with 00:1e:58:bf:ee:f5 [PTK=TKIP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to 00:1e:58:bf:ee:f5 completed (auth) [id=0 id_str=]
CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
Authentication with 00:00:00:00:00:00 timed out.
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
Authentication with 00:00:00:00:00:00 timed out.
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
WPA: No SSID info found (msg 1 of 4).
Authentication with 00:00:00:00:00:00 timed out.
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
WPA: EAPOL-Key Replay Counter did not increase - dropping packet
WPA: EAPOL-Key Replay Counter did not increase - dropping packet
WPA: EAPOL-Key Replay Counter did not increase - dropping packet
Authentication with 00:00:00:00:00:00 timed out.
Trying to associate with 00:1e:58:bf:ee:f5 (SSID='holmsap' freq=2437 MHz)
```

it's without -D param. why it looses sid? timeouts.. strange things happens.


----------



## holms (Nov 28, 2008)

ok it's solved.

I made drivet with ndis, and kldloaded ndis, if_ndis and /path/to/your/driver_sys.ko and it works. connected after 2-3 attempts. 

[for those who kldload writes 'operation not permitted' set kern.securelevel_enabled="NO" or/and kern.securelevel="0" in rc.conf]


----------



## billt (Feb 6, 2009)

*It might be more simple than you think.*

I use an ral0 card, in 7.0 and, now, 7.1. But, I didn't have to use more than the following:

```
cat /etc/wpa_supplicant.conf
network={
        ssid="NO-SSID-FOR-YOU"
        psk=9ecd...
}
```

and, in /etc/rc.conf:

```
ifconfig_ral0="WPA inet 172.30.3.3 netmask 0xffffff00"
```

However, once it is up it doesn't say up for more than about 12 hours; it likes to go up and down. If it weren't for the serial cable I have connected to the device I it would drive me absolutely crazy dealing with it.

- The serial connection allows me to login, ping the host I want to connect to the FreeBSD box from and THEN log in from that remote host.


----------

