Candidate for Deletion
Setting up the rt61 card requires compiling the kernel modules. This is very simple if you follow the below step by step instructions. These instructions have been tested on Ubuntu 6.10 (a.k.a. Ubuntu Edgy Eft), they could work on other release of Ubuntu.
**NOTE: On Ubuntu 8.10 (intrepid), rt61 seems to work out of the box so you doný need to take any of these steps!
Installing the necessary packages for the compilation
You will need to install a few packages for the compilation process. For installation of packages, please refer to InstallingSoftware.
If you are familiar with the command line, you could type the following command:
$ sudo apt-get install linux-headers build-essential gcc
If you get the error:
You should explicitly select one to install. E: Package linux-headers has no installation candidate
sudo apt-get install linux-headers-`uname -r` build-essential gcc
Getting the RT61 Driver from Ralink
Ralink Web Site have the Linux driver for download, check http://www.ralinktech.com/support.php?s=2 and download the latest stable version (the current version is 18.104.22.168 as of January 2007: RT61_Linux_STA_Drv22.214.171.124.tar.gz). To download the version, you can use your favourite browser, or you can use the command line as follow:
$ wget http://www.ralinktech.com/download.php?t=U0wyRnpjMlYwY3k4eU1EQTVMekF6THpNeEwyUnZkMjVzYjJGa056YzBPVEF6TmpVME55NWllakk5UFQweU1EQTVYekF4TWpOZlVsUTJNVjlNYVc1MWVGOVRWRUZmZGpFdU1TNHlMak11ZEdGeUM=
* a note form a community user who changed this doc,: read the readme.file. i have just changed the urls to correct ones.
Compilation of the Module (driver)
You will need to enter the following operations on the command line. It is assumed that the downloaded driver is in the current directory.
$ tar xvfz 2009_0123_RT61_Linux_STA_v126.96.36.199.tar.bz2 $ cd 2009_0123_RT61_Linux_STA_v188.8.131.52/Module/ $ cp -f Makefile.6 Makefile
Now, (at least for Gutsy) you need to do a minor modification to one of the files to make it compile. The following sed and mv commands do the job.
$ sed 's/pci_module_init/pci_register_driver/' < rtmp_main.c > rtmp_main.c2 $ mv rtmp_main.c2 rtmp_main.c
Also, change this in rtmp_main.c (starting line 196)
#if WIRELESS_EXT >= 12 net_dev->get_wireless_stats = RT61_get_wireless_stats; net_dev->wireless_handlers = (struct iw_handler_def *) &rt61_iw_handler_def; #endif
#if WIRELESS_EXT >= 12 #if WIRELESS_EXT < 17 net_dev->get_wireless_stats = RT61_get_wireless_stats; #endif net_dev->wireless_handlers = (struct iw_handler_def *) &rt61_iw_handler_def; #endif
Finally, execute make to build the module.
$ make all
The module is now compiled.
Installation of the module
Continuing from the previous section, you will need to enter the following commands:
$ sudo mkdir -p /etc/Wireless/RT61STA/ $ sudo cp *.bin rt61sta.dat /etc/Wireless/RT61STA/ $ sudo cp rt61.ko /lib/modules/`uname -r`/kernel/drivers/net/ $ sudo depmod
Configuration of the module
The Ralink modules is configured using a single file. If you know how to use vi or vim, it is perhaps more suitable to use it. But in case you do not, you can use gedit but take care not to use any characters that are not ASCII.
The vi way
$ sudo vi -b /etc/Wireless/RT61STA/rt61sta.dat
The gedit way
$ gksudo gedit --encoding=ISO-8859-15 /etc/Wireless/RT61STA/rt61sta.dat
What to modify?
At this point you need to look at the readme/docs, basically you set most stuff up in this data file rather than /etc/network/interfaces.
$ sudo iwlist ra0 scan
to find out what networks the card can find.
For WPAPSK authentication, you could change the settings as following:
SSID=<SSID of your Access Point> NetworkType=Infra AuthMode=WPAPSK EncrypType=TKIP WPAPSK=<Secret WPA key>
NOTE: For some reason there seem to be problems if the WPA key is longer than 52 characters and/or contains non-alphanumeric characters.
Activating the module (driver)
The pre-installed module, which is broken has to be removed. From the command line, enter:
$ modprobe --remove rt61pci
Then, we can load the new module that we have just installed:
$ modprobe rt61
To check if the module is activated and working, you should verify that ra0 device is visible in the output of iwconfig:
Setting up the system
As we did in the previous step, we need to deactivate the pre-installed module. This can be done automatically at start-up by adding an entry in a black list. From the command line:
$ echo 'blacklist rt61pci' >> /etc/modprobe.d/blacklist
Then, the correct (newly installed) module has to be loaded (do not forget the option '-a' after the tee command):
$ echo 'rt61' | sudo tee -a /etc/modules $ echo 'alias ra0 rt61' | sudo tee -a /etc/modprobe.d/aliases
The last step is to modify the file /etc/network/interfaces to set-up your specific networking settings. Depending if you want to use DHCP (recommended) or static IP address you have two different configuration, but in both case you need to first edit the file:
$ gksudo gedit /etc/network/interfaces
Dynamic IP - DHCP (recommended)
The content of the interfaces file should look like this:
iface ra0 inet dhcp auto ra0
The content of the interfaces file should look like this:
iface ra0 inet static address <your chosen ip> netmask 255.255.255.0 gateway <ip of your access point> auto ra0
Getting your network up and running
Everything is now done, you just have to tell so to Ubuntu. You can either reboot, but instead of loosing your time, you can simply type this command:
$ sudo ifup ra0
Feisty Fawn Installation
With Fesity Fawn the rt61 drivers are included in the basic install. So downloading and compiling drivers is unecessary. It may be important (and time saving) for you to note that if you require either no or WEP encryption the Network Manager applet can usually be used seccessfully to establish connectivity. This guie will concentrate on getting WPA encryption to work. Specifically WPA-PSK using TKIP.
Which Chip Set Do I Have?
The rt61 has two main chipset types
lspci | grep Ra 05:00.0 Network controller: RaLink RT2561/RT61 802.11g PCI
- (note that PCI could be replaced with USB or another bus type) and the later version
lspci | grep Ra 05:00.0 Network controller: RaLink RT2561/RT61 rev B 802.11g
If your system is running the rev B version you can continue with this guide as is. However if you are using the original then you will need to uninstall the Network Manager applet as otherwise the network destinations will always return as unreachable. The Network Manager can be uninstalled using the following command:
sudo dpkg -P network-manager network-manager-gnome
The first thing to do is check that Ubuntu has indeed detected your card and that the appropriate driver is available. This is done as follows:
$lsmod | grep rt61 rt61 245128 1 $modinfo rt61 filename: /lib/modules/2.6.20-15-generic/kernel/ubuntu/wireless/rt2x00-legacy/rt61/rt61.ko license: GPL description: Ralink RT61 802.11abg WLAN Driver 1.1.0 CVS CVS author: http://rt2x00.serialmonkey.com srcversion: 180F8980D3385B365E8F654 alias: pci:v00001814d00000401sv*sd*bc*sc*i* alias: pci:v00001814d00000302sv*sd*bc*sc*i* alias: pci:v00001814d00000301sv*sd*bc*sc*i* depends: vermagic: 2.6.20-15-generic SMP mod_unload 586 parm: debug:Enable level: accepted values: 1 to switch debug on, 0 to switch debug off. (int) parm: ifname:Network device name (default ra%d) (charp)
Next, having established that the card is recognised and an appropriate driver is available you need to check that Ubuntu has already configured an interface for the device.
$ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 brd 127.255.255.255 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 4: ra1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:18:39:13:96:74 brd ff:ff:ff:ff:ff:ff inet 192.168.1.9/24 scope global eth0 inet6 fe80::218:39ff:fe13:9674/64 scope link valid_lft forever preferred_lft forever
This shows that the interface has been configured as ra1. Note that in previous versions of Ubuntu, this would be ra0, but in Feisy Fawn it is normal for a fresh installation to name the interface as ra1.
Disabling the Interface
The interface needs to be taken down in order for the changes we are going to make to take effect. This is done as follows:
$sudo ip link set dev ra1 down
It is a good idea to type ip a after this in order to check the device has been taken down successfully. If it has then the ra1 interface should not appear in the output.
Configuring the connection
The next job is to configure the connection with the parameters specific to your network. For this you will need your: 1. SSID (Network Name as broadcast by the router) 2. Encryption Type (Here we are assuming WPAPSK TKIP 3. Secret WPA Key (this is the hexadecimal key NOT the passphrase. If you only have the passphrase you can generate your WPA Key using the following command:
$ wpa_passphrase YOUR_SSID YOUR_PASSPHRASE
OK now the connection can be configured as follows
$ sudo iwconfig ra0 essid YOUR_SSID $ sudo iwpriv ra0 set AuthMode=WPAPSK $ sudo iwpriv ra0 set WPAPSK="YOUR_WPA_KEY" $ sudo iwpriv ra0 set EncrypType=TKIP
Typing iwconfig should display the new details of your connection. However don't worry if it the link quality is still 0/100 because sometimes the changes don't apply until the interface is brouught up again.
IP and Routing Details
The next thing to do is set the IP address of the card and bring it back online (up)
$ sudo ip addr add DESIRED_ADDRESS/PREFIXLEN dev ra1 $ sudo ip link set dev ra1 up $ iwconfig lo no wireless extensions. eth0 no wireless extensions. ra1 RT61 Wireless ESSID:"YOUR_SSID" Nickname:"" Mode:Managed Frequency:2.427 GHz Access Point: XX:XX:XX:XX:XX:XX Bit Rate=54 Mb/s RTS thr:off Fragment thr:off Link Quality=75/100 Signal level:-59 dBm Noise level:-95 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
OK so now the IP address is all set up and the network can detect the network and has a link quality of above 0. The next thing is to set up the routing table. Delete the default gateway from your machine and replace it with that of the new connection.
$ sudo route del default $ sudo route add default gw GATEWAY_IPADDRESS
The Gateway IP address is usually the internal IP address of your router. Typing route at the command line should show you the inclusion of the default path to the wireless gateway.
You can now test this link by pinging the router
$ ping GATEWAY_IPADDRESS PING GATEWAY_IPADDRESS (GATEWAY_IPADDRESS) 56(84) bytes of data. 64 bytes from GATEWAY_IPADDRESS: icmp_seq=1 ttl=64 time=6.31 ms 64 bytes from GATEWAY_IPADDRESS: icmp_seq=2 ttl=64 time=1.01 ms 64 bytes from GATEWAY_IPADDRESS: icmp_seq=3 ttl=64 time=1.00 ms 64 bytes from GATEWAY_IPADDRESS: icmp_seq=4 ttl=64 time=1.04 ms 64 bytes from GATEWAY_IPADDRESS: icmp_seq=5 ttl=64 time=1.02 ms 64 bytes from GATEWAY_IPADDRESS: icmp_seq=6 ttl=64 time=1.00 ms ...
We are almost there but, at present the computer can only communicate with the gateway as it does not know where to find other hosts. For this we need to establish a DNS (Domain Name Server).
$ sudo echo "nameserver GATEWAY_IPADDRESS" >> /etc/resolv.conf $ ping www.google.com
You should now find that the computer can ping any address on the internet.
Automatic Configuration on Startup
Obviously you won't be wanting to go through this process every time the computer boots so we need to write a script in order to do this for us. There is a configuration file called /etc/network/interfaces that we need to modify in order to make this happen.
$ sudo gedit /etc/network/interfaces
At the beginning add the following code:
auto ra1 iface ra1 inet static address YOUR_IP netmask YOUR_NETMASK gateway GATEWAY_IPADDRESS pre-up iwpriv ra1 set AuthMode=WPAPSK pre-up iwpriv ra1 set EncrypType=TKIP pre-up iwconfig ra1 essid YOUR_SSID pre-up iwpriv ra1 set WPAPSK="YOUR_PSKKEY"