特殊:Badtitle/NS100:WifiDocs/Driver/RalinkRT61:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Wikibot留言 | 贡献
无编辑摘要
qCmVIcihHJ
 
(未显示1个用户的6个中间版本)
第1行: 第1行:
{{From|https://help.ubuntu.com/community/WifiDocs/Driver/RalinkRT61}}
Phenomenal breakdown of the topic, you shuold write for me too!
{{Languages|UbuntuHelp:WifiDocs/Driver/RalinkRT61}}
=== Introduction ===
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.
=== 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 [[UbuntuHelp:InstallingSoftware|InstallingSoftware]].
* gcc
* build-essential
* linux-headers
If you are familiar with the command line, you could type the following command:
<pre><nowiki>
$ sudo apt-get install linux-headers build-essential gcc
</nowiki></pre>
=== Getting the RT61 Driver from Ralink ===
Ralink Web Site have the Linux driver for download, check [http://web.ralinktech.com/ralink/Home/Support/Linux.html] and download the latest stable version (the current version is 1.1.0.0 as of January 2007: RT61_Linux_STA_Drv1.1.0.0.tar.gz).
To download the version, you can use your favourite browser, or you can use the command line as follow:
<pre><nowiki>
$ wget http://www.ralinktech.com.tw/data/RT61_Linux_STA_Drv1.1.0.0.tar.gz
</nowiki></pre>
=== 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.
<pre><nowiki>
$ tar xvfz RT61_Linux_STA_Drv1.1.0.0.tar.gz
$ cd RT61_Linux_STA_Drv1.1.0.0/Module/
$ cp -f Makefile.6 Makefile
</nowiki></pre>
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.
<pre><nowiki>
$ sed 's/pci_module_init/pci_register_driver/' < rtmp_main.c > rtmp_main.c2
$ mv rtmp_main.c2 rtmp_main.c
</nowiki></pre>
Finally, execute make to build the module.
<pre><nowiki>
$ make all
</nowiki></pre>
The module is now compiled.
=== Installation of the module ===
Continuing from the previous section, you will need to enter the following commands:
<pre><nowiki>
$ 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
</nowiki></pre>
=== 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 ====
<pre><nowiki>
$ sudo vi -b /etc/Wireless/RT61STA/rt61sta.dat
</nowiki></pre>
==== The gedit way ====
<pre><nowiki>
$ gksudo gedit --encoding=ISO-8859-15 /etc/Wireless/RT61STA/rt61sta.dat
</nowiki></pre>
==== 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.
Run
<pre><nowiki>
$ sudo iwlist ra0 scan
</nowiki></pre>
to find out what networks the card can find.
For WPAPSK authentication, you could change the settings as following:
<pre><nowiki>
SSID=<SSID of your Access Point>
NetworkType=Infra
AuthMode=WPAPSK
EncrypType=TKIP
WPAPSK=<Secret WPA key>
</nowiki></pre>
'''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:
<pre><nowiki>
$ modprobe --remove rt61pci
</nowiki></pre>
Then, we can load the new module that we have just installed:
<pre><nowiki>
$ modprobe rt61
</nowiki></pre>
To check if the module is activated and working, you should verify that ra0 device is visible in the output of iwconfig:
<pre><nowiki>
$ iwconfig
</nowiki></pre>
=== 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:
<pre><nowiki>
$ echo 'blacklist rt61pci' >> /etc/modprobe.d/blacklist
</nowiki></pre>
Then, the correct (newly installed) module has to be loaded (do not forget the option '-a' after the ''tee'' command):
<pre><nowiki>
$ echo 'rt61' | sudo tee -a /etc/modules
$ echo 'alias ra0 rt61' | sudo tee -a /etc/modprobe.d/aliases
</nowiki></pre>
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:
<pre><nowiki>
$ gksudo gedit /etc/network/interfaces
</nowiki></pre>
==== Dynamic IP - DHCP (recommended) ====
The content of the interfaces file should look like this:
<pre><nowiki>
iface ra0 inet dhcp
auto ra0
</nowiki></pre>
==== Static IP ====
The content of the interfaces file should look like this:
<pre><nowiki>
iface ra0 inet static
address <your chosen ip>
netmask 255.255.255.0
gateway <ip of your access point>
auto ra0
</nowiki></pre>
==== 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:
<pre><nowiki>
$ sudo ifup ra0
</nowiki></pre>
=== 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
<pre><nowiki>lspci | grep Ra
05:00.0 Network controller: RaLink RT2561/RT61 802.11g PCI
</nowiki></pre>
(note that PCI could be replaced with USB or another bus type) and the later version
<pre><nowiki>lspci | grep Ra
05:00.0 Network controller: RaLink RT2561/RT61 rev B 802.11g
</nowiki></pre>
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:
<pre><nowiki>sudo dpkg -P network-manager network-manager-gnome
</nowiki></pre>
=== Getting Started ===
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:
<pre><nowiki>
$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)
</nowiki></pre>
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.
<pre><nowiki>
$ ifconfig
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:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:100 (100.0 b)  TX bytes:100 (100.0 b)
 
ra1      Link encap:Ethernet  HWaddr 00:18:39:13:96:74 
          inet addr:192.168.1.9  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::218:39ff:fe13:9674/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15714 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1171 errors:4 dropped:4 overruns:0 carrier:0
          collisions:80 txqueuelen:1000
          RX bytes:23
</nowiki></pre>
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:
<pre><nowiki>
$sudo ifconfig ra1 down
</nowiki></pre>
It is a good idea to type ifconfig 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:
<pre><nowiki>
$ wpa_passphrase YOUR_SSID YOUR_PASSPHRASE
</nowiki></pre>
OK now the connection can be configured as follows
<pre><nowiki>
$ 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
</nowiki></pre>
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)
<pre><nowiki>
$ sudo ifconfig ra1 DESIRED_IP netmask YOUR_NETMASK 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
</nowiki></pre>
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.
<pre><nowiki>
$ sudo route del default
$ sudo route add default gw GATEWAY_IPADDRESS
</nowiki></pre>
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
<pre><nowiki>
$ 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
...
</nowiki></pre>
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).
<pre><nowiki>
$ sudo echo "nameserver GATEWAY_IPADDRESS" >> /etc/resolv.conf
$ ping www.google.com
</nowiki></pre>
You should now find that the computer can ping any address on the internet.
HAPPY BROWSING!!
=== 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.
<pre><nowiki>
$ sudo gedit /etc/network/interfaces
</nowiki></pre>
At the beginning add the following code:
<pre><nowiki>
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"
</nowiki></pre>
----
[[category:CategoryDocumentation]] [[category:CategoryHardware]] [[category:CategoryCleanup]]
 
[[category:UbuntuHelp]]

2011年8月16日 (二) 01:49的最新版本

Phenomenal breakdown of the topic, you shuold write for me too!