# wireless network setup: RaLink 3090 with WPA2

## jeanluca

Hi All

I've tried a couple of things to get my ralink card working and tried to connect to my router through WPA2

1) I installed the driver for my Ralink (downloaded the 2009_0612_RT3090_Linux_STA_V2.1.0.0_DPO driver source) seems to work  :Smile: 

2) ifconfig -a

```
eth0      Link encap:Ethernet  HWaddr 00:01:c0:05:c2:25  

          inet addr:192.168.1.19  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::201:c0ff:fe05:c225/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:41202 errors:0 dropped:0 overruns:0 frame:0

          TX packets:27059 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:45859686 (43.7 MiB)  TX bytes:2933665 (2.7 MiB)

          Interrupt:16 Base address:0x2000 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ra0       Link encap:Ethernet  HWaddr 00:00:00:00:00:00  

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

          Interrupt:17 

```

/etc/conf.d/net

```

modules="wpa_supplicant"

wpa_supplicant_ra0="-Dwext"

config_ra0="dhcp"

config_eth0="dhcp"

dhcp_eth0="nontp" 

```

/etc/wpa_supplicant/wpa_supplicant.conf

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

#wpa_supplicant_ra0="-Drt3090sta"

ap_scan=1

network={

   ssid="myrouter"

   #key_mgmt-WPA-PSK

   pairwise=CCMP

   group=CCMP

   proto=RSN

   psk=9c8b27977aac392afe3fffee0dd513e3b174fdb6466f99d4c7662e1b2e85e184

}

```

I've no idea what to put in wpa_supplicant.conf, so I can connect with my router which uses 'WPA2'

For example, if I do

```
# /etc/init.d/net.ra0 start

 * Caching service dependencies ...                                                                                                                                                                                                                                          [ ok ]

 * Starting ra0

SIOCSIFFLAGS: Operation not permitted

SIOCSIFFLAGS: Operation not permitted

 *   Starting wpa_supplicant on ra0 ...

SIOCSIFFLAGS: Operation not permitted

SIOCSIFFLAGS: Operation not permitted

Could not set interface 'ra0' UP                                                                                                                                                                                                                                             [ ok ]

 *   Starting wpa_cli on ra0 ...                                                                                                                                                                                                                                             [ ok ]

 *     Backgrounding ...

```

Doesn't look right, but it does something  :Smile: 

```

$> wpa_cli 

wpa_cli 

wpa_cli v0.6.4

Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi> and contributors

This program is free software. You can distribute it and/or modify it

under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the

BSD license. See README and COPYING for more details.

Selected interface 'ra0'

Interactive mode

> <2>CTRL-EVENT-SCAN-RESULTS 

<2>CTRL-EVENT-SCAN-RESULTS 

<2>CTRL-EVENT-SCAN-RESULTS 

```

Any help would be appreciated, because I've now clue whats going on here!?

----------

## DONAHUE

Try this (changes in blue)

/etc/conf.d/net:

 *Quote:*   

> modules_ra0="wpa_supplicant"
> 
> #wpa_supplicant_ra0="-Dwext"
> 
> config_ra0="dhcp"
> ...

 

/etc/wpa_supplicant/wpa_supplicant.conf:

 *Quote:*   

> ctrl_interface=/var/run/wpa_supplicant
> 
> ctrl_interface_group=0 
> 
> #wpa_supplicant_ra0="-Drt3090sta"
> ...

 

break the /etc/init.d/net.eth0 -> /etc/init.d/net.lo link

```
rm /etc/init.d/net.eth0
```

check/make the /etc/init.d/net.ra0 -> /etc/init.d/net.lo link

```
ls -l /etc/init.d/ | grep -i ra0
```

If net.ra0 -> net.lo does not show up:

```
cd /etc/init.d

ln -s net.lo net.ra0
```

let hal and udev start the nic:

```
rc-update del net.eth0

rc-update del net.ra0
```

----------

## jeanluca

thnx a lot!! I guess the configuration files are now correct, but I still get the SIOCSIFFLAGS messages

```
/etc/init.d/net.ra0 start 

 * One of the files in /etc/{conf.d,init.d} or /etc/rc.conf

 * has a modification time in the future!

 * Caching service dependencies ...                                                                                                                                                                                                                                          [ ok ]

 * Starting ra0

SIOCSIFFLAGS: Operation not permitted

SIOCSIFFLAGS: Operation not permitted

 *   Starting wpa_supplicant on ra0 ...

SIOCSIFFLAGS: Operation not permitted

SIOCSIFFLAGS: Operation not permitted

Could not set interface 'ra0' UP                                                                                                                                                                                                                                             [ ok ]

 *   Starting wpa_cli on ra0 ...                                                                                                                                                                                                                                             [ ok ]

 *     Backgrounding ...

```

Is this something which might be caused by a miss configured kernel ?

BTW I didn't remove net.eth0 because I work remote on this machine

----------

## DONAHUE

* has a modification time in the future! --> your clock was/is misset

Before compiling the rt3090 driver did you?

 *Quote:*   

> In <your path>/2009_0612_RT3090_Linux_STA_V2.1.0.0_DPOos/linux/config.mk 
> 
> 	** Build for being controlled by NetworkManager or wpa_supplicant wext functions
> 
> 	   Please set 'HAS_WPA_SUPPLICANT=y' and 'HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y'.

 Last edited by DONAHUE on Mon Jul 20, 2009 2:08 pm; edited 1 time in total

----------

## jeanluca

I missed the firmware  :Smile: 

So, now its all working. I can do

```
$> iwlist ra0 scan
```

However it doesn't connect with my router!

If I do net.ra0 start I see the following in my messages

```
ul 20 17:04:14 tux RX DESC e7fa2000  size = 2048

Jul 20 17:04:14 tux <-- RTMPAllocTxRxRingMemory, Status=0

Jul 20 17:04:14 tux Key1Str is Invalid key length(0) or Type(0)

Jul 20 17:04:14 tux Key2Str is Invalid key length(0) or Type(0)

Jul 20 17:04:14 tux Key3Str is Invalid key length(0) or Type(0)

Jul 20 17:04:14 tux Key4Str is Invalid key length(0) or Type(0)

Jul 20 17:04:14 tux AntDiversity=0

Jul 20 17:04:14 tux 1. Phy Mode = 9

Jul 20 17:04:14 tux 2. Phy Mode = 9

Jul 20 17:04:14 tux NVM is Efuse and its size =2d[2d0-2fc] 

Jul 20 17:04:14 tux 3. Phy Mode = 9

Jul 20 17:04:14 tux RTMPSetPhyMode: channel is out of range, use first channel=1 

Jul 20 17:04:14 tux MCS Set = ff 00 00 00 01

Jul 20 17:04:14 tux <==== rt28xx_init, Status=0

Jul 20 17:04:14 tux 0x1300 = 00064300

Jul 20 17:04:14 tux AUX_CTRL = 0x                            1d42

Jul 20 17:04:14 tux Read AUX_CTRL = 0x1d42

Jul 20 17:04:14 tux Write AUX_CTRL = 0x1d42

Jul 20 17:04:14 tux OSC_CTRL = 0x3ff11

Jul 20 17:04:14 tux ====> rt30xx Read PowerLevelMode =  0x3.

Jul 20 17:04:14 tux ====> rt30xx F Write 0x83 Command = 0x3.

Jul 20 17:04:20 tux ===>rt_ioctl_giwscan. 3(3) BSS returned, data->length = 478

Jul 20 17:04:20 tux ==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x8b04] (Channel=1)

Jul 20 17:04:24 tux ra0: no IPv6 routers present

Jul 20 17:04:35 tux ===>rt_ioctl_giwscan. 3(3) BSS returned, data->length = 478

Jul 20 17:04:35 tux ==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x8b04] (Channel=1)

```

I get the impression something is wrong with the key!?

UPDATE: the key was generated as follows

```

$> wpa_passphrase myrouter "djwkdiddj ekajsjehins"

```

----------

## DONAHUE

I use an 8 character key which requires quotes, PSK="abcdefgh"

The router has the same key as the NIC?

Before compiling the rt3090 driver did you?

Quote:

In <your path>/2009_0612_RT3090_Linux_STA_V2.1.0.0_DPOos/linux/config.mk

** Build for being controlled by NetworkManager or wpa_supplicant wext functions

Please set 'HAS_WPA_SUPPLICANT=y' and 'HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y'.

----------

## jeanluca

wow, thats it  :Smile: 

The strange thing is that I still see the Key1Str problem:

```
Jul 20 17:49:45 tux RX DESC f6383000  size = 2048

Jul 20 17:49:45 tux <-- RTMPAllocTxRxRingMemory, Status=0

Jul 20 17:49:45 tux Key1Str is Invalid key length(0) or Type(0)

Jul 20 17:49:45 tux Key2Str is Invalid key length(0) or Type(0)

Jul 20 17:49:45 tux Key3Str is Invalid key length(0) or Type(0)

Jul 20 17:49:45 tux Key4Str is Invalid key length(0) or Type(0)

Jul 20 17:49:45 tux AntDiversity=0

Jul 20 17:49:45 tux 1. Phy Mode = 9

Jul 20 17:49:45 tux 2. Phy Mode = 9

Jul 20 17:49:45 tux NVM is Efuse and its size =2d[2d0-2fc] 

Jul 20 17:49:45 tux 3. Phy Mode = 9

Jul 20 17:49:45 tux RTMPSetPhyMode: channel is out of range, use first channel=1 

Jul 20 17:49:45 tux MCS Set = ff 00 00 00 01

Jul 20 17:49:46 tux <==== rt28xx_init, Status=0

Jul 20 17:49:46 tux 0x1300 = 00064300

Jul 20 17:49:46 tux AUX_CTRL = 0x                            1d42

Jul 20 17:49:46 tux Read AUX_CTRL = 0x1d42

Jul 20 17:49:46 tux Write AUX_CTRL = 0x1d42

Jul 20 17:49:46 tux OSC_CTRL = 0x3ff11

Jul 20 17:49:46 tux ====> rt30xx Read PowerLevelMode =  0x3.

Jul 20 17:49:46 tux ====> rt30xx F Write 0x83 Command = 0x3.

Jul 20 17:49:51 tux ===>rt_ioctl_giwscan. 3(3) BSS returned, data->length = 478

Jul 20 17:49:51 tux ==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x8b04] (Channel=1)

Jul 20 17:49:51 tux wpa_cli: interface ra0 CONNECTED

Jul 20 17:49:52 tux dhcpcd[13407]: ra0: dhcpcd 4.0.13 starting

Jul 20 17:49:52 tux dhcpcd[13407]: ra0: broadcasting for a lease

Jul 20 17:49:53 tux dhcpcd[13407]: ra0: offered 192.168.1.22 from 192.168.1.1

Jul 20 17:49:53 tux dhcpcd[13407]: ra0: acknowledged 192.168.1.22 from 192.168.1.1

Jul 20 17:49:53 tux dhcpcd[13407]: ra0: checking 192.168.1.22 is available on attached networks

Jul 20 17:49:53 tux dhcpcd[13407]: ra0: ignoring message; no Server ID

Jul 20 17:49:56 tux ra0: no IPv6 routers present

Jul 20 17:49:58 tux dhcpcd[13407]: ra0: leased 192.168.1.22 for 604800 seconds

```

so I guess it has to do with something else!!

Thnx you so much!!

----------

## DONAHUE

 *Quote:*   

> Jul 20 17:49:45 tux Key1Str is Invalid key length(0) or Type(0)
> 
> Jul 20 17:49:45 tux Key2Str is Invalid key length(0) or Type(0)
> 
> Jul 20 17:49:45 tux Key3Str is Invalid key length(0) or Type(0)
> ...

 

related to WEP, i believe, so not meaningful for your situation.

excellent catch on the firmware, my 2860 compiles/installs put the firmware on integrally, I would have been a longtime guessing on that.

----------

## jeanluca

the firmware problem is really odd. Also the location (/etc/Wireless) is strange. For those interested, the fix is:

```
$> cd /etc/Wireless

$> ln -s ln -s RT3090STA RT2860STA

```

One more thing, when I remove net.eth0 and net.ra0 from rc-update I don't think anything will start!

So, what shoud udev do ?

UPDATE: I donwloaded the driver from http://www.ralinktech.com/ralink/Home/Support/Linux.htmlLast edited by jeanluca on Tue Jul 21, 2009 12:09 pm; edited 2 times in total

----------

## DONAHUE

if they don't start, leave them in.

If they don't start, I probably have made some kernel choices that you haven't or vice versa.

I have dbus and hal in USE=" in /etc/make.conf

----------

## jeanluca

If I add hal and dbus and rebuild some packages I get the following message during boot

```
waiting for uevents to be processed
```

which seems to take forever (it never continues), so I think I'll keep net.ra0! and remove hal and dbus!

thnx a lot

LuCa

----------

