Ubuntu Linux: Install RT2870 Chipset Based USB Wireless Adapter(转)

This blog post listed Linux Compatible USB wireless adapters. It seems that many new Linux users frequently have problems learning how to install RT2870 driver under Linux. I also received email requesting installation instructions for the same device. This quick tutorial will explains how to install RT2870 based chipset device with WPA2 authentication and TKIP wireless encryption.

Our Sample Setup

The following instructions are tested on:

  • Ubuntu Linux 10.04.1 LTS
  • Kernel - Linux 2.6.32-24-generic-pae i686 (32 bit)
  • WPA2 with Linksys 160N router

RT2870 Chipset Based Devices Are Not Working Out Of Box

The main problem is conflicting driver which are shipped with default kernel. WPA2 is a method of security wireless networking with optional PSK for home users. The default driver only recognizes driver but always failed to join WPA2 based network. The solution is to install RT2870 driver from the vendor site.

Step #1: Disable Default Drivers

Type the following command to black list default drivers:
$ sudo vi /etc/modprobe.d/blacklist.conf
Append the following driver names:

blacklist rt2800usb
blacklist rt2x00lib
blacklist rt2x00usb

Save and close the file. Use the rmmod command to remove current drivers or just reboot the system:
$ sudo modprobe -r driverName
# you need to remove all of the above drivers one by one:
$ sudo modprobe -r rt2800usb

OR simply reboot the systems:
$ sudo reboot

Step 2: Install Compilers

Type the following command to install required packages so that you can compile source code:
$ sudo apt-get install build-essential fakeroot dpkg-dev
Finally, install Linux kernel headers so that you can compile kernel device drivers:
$ sudo apt-get install linux-headers-$(uname -r)

Step #3: Download Driver

Visit this page and download USB drivers [RT2870USB(RT2870/RT2770)].

Untar Tarball

Type the following command:
$ tar -jxvf 2010_0709_RT2870_Linux_STA_v2.4.0.1.tar.bz2
$ cd 2010_0709_RT2870_Linux_STA_v2.4.0.1

Compile RT2870 Wireless Lan Linux Driver

First, edit config.mk file as follows so that Network Manager can be used to set WPA2 auth info:
$ vi os/linux/config.mk
Set it as follows:

# Support Wpa_Supplicant
HAS_WPA_SUPPLICANT=y
# Support Native WpaSupplicant for Network Manger
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y

Save and close the file. To compile the driver, enter:
$ make
Sample outputs:

make -C tools
make[1]: Entering directory `/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/tools‘
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory `/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/tools‘
/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/tools/bin2h
cp -f os/linux/Makefile.6 /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/Makefile
make -C /lib/modules/2.6.32-24-generic-pae/build SUBDIRS=/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-24-generic-pae‘
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/crypt_md5.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/crypt_sha2.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/crypt_hmac.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/crypt_aes.o
...
....
..
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtusb_io.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtusb_bulk.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtusb_data.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/cmm_data_usb.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/ee_prom.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtmp_mcu.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtusb_dev_id.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../os/linux/rt_usb.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../os/linux/rt_usb_util.o
  CC [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../os/linux/usb_main_dev.o
  LD [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/rt2870sta.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/rt2870sta.mod.o
  LD [M]  /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/rt2870sta.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-24-generic-pae‘

Note: You may see a LOTs of warnings during the compilation, and this is *normal* so don‘t panic.

Install Driver

Type the following command:
$ sudo make install
Sample outputs:

make -C /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux -f Makefile.6 install
make[1]: Entering directory `/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux‘
rm -rf /etc/Wireless/RT2870STA
mkdir /etc/Wireless/RT2870STA
cp /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/RT2870STA.dat /etc/Wireless/RT2870STA/.
install -d /lib/modules/2.6.32-24-generic-pae/kernel/drivers/net/wireless/
install -m 644 -c rt2870sta.ko /lib/modules/2.6.32-24-generic-pae/kernel/drivers/net/wireless/
/sbin/depmod -a 2.6.32-24-generic-pae
make[1]: Leaving directory `/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux‘

Install Latest Firmware

Again visit this page and download "Firmware RT28XX/RT30XX USB series (RT2870/RT2770/RT3572/RT3070)". Unzip and install the firemware:
$ unzip RT2870_Firmware_V22.zip
$ cd RT2870_Firmware_V22/
#### Make a backup of existing old firmware ####
$ mkdir -p $HOME/backup/lib/firmware
$ cp /lib/firmware/rt2870.bin $HOME/backup/lib/firmware
#### Install the firmware (for 64 bit Linux systems, you may have to use /lib64/firmware) #####
$ sudo cp rt2870.bin /lib/firmware/
##### **** backup and move existing driver, do NOT SKIP this STEP ****######
$ sudo mv /lib/modules/$(uname -r)/kernel/drivers/net/wireless/rt2870sta.ko $HOME/backup/

Update usb.ids

Type the following commands:
$ mkdir -p $HOME/backup/var/lib/usbutils
$ cp /var/lib/usbutils/usb.ids $HOME/backup/var/lib/usbutils
$ sudo wget -O /var/lib/usbutils/usb.ids http://www.linux-usb.org/usb.ids

Step #4: Configure Driver

Connect your USB device and type the following command to verify that Wireless USB LAN adapter is detected:
$ lsusb
Sample outputs:

Bus 002 Device 007: ID 0411:00e8 MelCo., Inc. Buffalo WLI-UC-G300N Wireless LAN Adapter
Bus 002 Device 006: ID 05ac:0220 Apple, Inc. Aluminum Keyboard (ANSI)
Bus 002 Device 005: ID 05ac:1006 Apple, Inc. Hub in Aluminum Keyboard
Bus 002 Device 004: ID 413c:2513 Dell Computer Corp.
Bus 002 Device 003: ID 413c:2513 Dell Computer Corp.
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 007: ID 413c:8160 Dell Computer Corp.
Bus 001 Device 006: ID 413c:8162 Dell Computer Corp.
Bus 001 Device 005: ID 413c:8161 Dell Computer Corp.
Bus 001 Device 004: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 001 Device 003: ID 0a5c:5800 Broadcom Corp. BCM5880 Secure Applications Processor
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/etc/Wireless/RT2870STA/RT2870STA.dat Configuration

You need to edit /etc/Wireless/RT2870STA/RT2870STA.dat file, enter:
$ sudo vi /etc/Wireless/RT2870STA/RT2870STA.dat
Set SSID (nixcraft is my SSID):

SSID=nixcraft

Set country (IN = INDIA, US = USA, etc):

CountryCode=IN

Set authentication information (do not skip this if you want WPA2 based authentication):

AuthMode=WPA2
EncrypType=TKIP
WPAPSK=YOUR-PASSWORD-HERE

See README_STA for other detailed information about each field. Save and close the file.

Step #5: Connect To the Internet

Type the ifconfig command and you should see ra0:
$ ifconfig ra0

ra0       Link encap:Ethernet  HWaddr 00:1d:73:bc:e4:6e
          inet6 addr: fe80::21d:73ff:febc:e46e/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:5157 errors:0 dropped:0 overruns:0 frame:0
          TX packets:206 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1093810 (1.0 MB)  TX bytes:16772 (16.7 KB)

You can now connect to the Internet by clicking on Network manager ( The network-manager is the one which is found in the systray. The icon of two computers, one below to the other on the left-side). Clicking on NM-applet will give you the types of connection/hardware you have available > Select Wireless Device > Select nixcraftSSID (or scan of SSID) > Make sure you set "WPA2" as wireless security. Once connected you can browse the Internet or verify IP info:
$ ifconfig ra0
Sample outputs:

ra0       Link encap:Ethernet  HWaddr 00:1d:73:bc:e4:6e
          inet addr:192.168.1.103  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21d:73ff:febc:e46e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6711 errors:0 dropped:0 overruns:0 frame:0
          TX packets:271 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1420879 (1.4 MB)  TX bytes:22312 (22.3 KB)

Verify gateway or just ping to public ip:
$ route -n
$ ping google.com
$ ping cyberciti.biz

A Note About Kernel Upgrades

You need to reinstall the driver using the above steps.

时间: 2024-11-03 21:45:31

Ubuntu Linux: Install RT2870 Chipset Based USB Wireless Adapter(转)的相关文章

HOWTO install Oracle 11g on Ubuntu Linux 12.04 (Precise Pangolin) 64bits

安装了Ubuntu 12.04 64bit, 想在上面安装Oracle 11gr2,网上找了好多文档都没成功,最后完全参考了MordicusEtCubitus的文章. 成功安装的关键点:install additional packages, 在link过程中处理错误的方法. 原文:http://www.makina-corpus.org/blog/howto-install-oracle-11g-ubuntu-linux-1204-precise-pangolin-64bits Before

Install LEMP (Linux, Nginx, MySQL and PHP) Stack on Ubuntu Linux 14.04 LTS(转)

Install LEMP (Linux, Nginx, MySQL and PHP) Stack on Ubuntu Linux 14.04 LTS Nginx Installation Nginx is one of the robust web server in Linux world. Nginx is a free, open source, high performance HTTP server and reverse proxy, as weell as an IMAP/POP3

开启Ubuntu Linux下VirtualBox访问USB功能

解决方法如下: 1.增加用户组usbfs sudo groupadd usbfs 2.查看usbfs用户组的gid cat /etc/group | grep usbfs usbfs:x:1002: 3.把当前用户增加到usbfs组 sudo gedit /etc/group 把 usbfs:x:1002: 修改为 usbfs:x:1002:joson(joson改为自己的用户名) 开启Ubuntu Linux下VirtualBox访问USB功能

How to install Wine on Ubuntu Linux 64bit

参考地址:https://linuxconfig.org/how-to-install-wine-on-ubuntu-linux-64bit The following linux command procedure can be used to install Wine the Microsoft Windows Compatibility Layer (Binary Emulator and Library) on Ubuntu Linux amd64. If you are running

Debian/Ubuntu Linux:使用Hostapd搭建无线访问点(WAP)

NIXCRAFT发表于2012年8月25日,在2014年7月9日更新,适用DEBIAN / UBUNTU, 网络, UBUNTU LINUX, 无线网络. 我们有个闲置的USB无线适配器(WIFI适配器),而我们的ISP路由器却是有线的.怎样把我们的家庭NAS服务器变成无线访问点(WAP),在不用买额外的WPA盒子的情况下,在Debian或Ubuntu系统下使用无线设备访问到它? 你需要使用hostapd作为访问点和认证服务器.它实现了IEEE 802.11访问点管理,IEEE802.1X/WP

[转载]Ubuntu Linux 入门(二):安装 Ubuntu Linux

转载自http://terrychen.info/ubuntu-linux-beginners-guide-ubuntu-installation/ 在 Ubuntu Linux 入门(一):安装 Ubuntu Linux 前的准备工作一文中,我们已经为安装 Ubuntu Linux 做好了必要的准备,下面可以开始正式的安装过程了. 1. Wubi 安装过程 选择 Wubi 安装的朋友,请按照以下步骤安装: 使用 Virtual CloneDrive 和 Daemon Tools Lite等虚拟

Ubuntu Linux下通过代理(proxy)使用git上github.com

github.com,作为程序员的代码仓库,我们经常会用到.但有时候我们不能直接通过网络链接它,只能通过代理. 这里我有一台代理服务器,起初我以为在终端设置了代理环境就行了,其设置为在你的~/.bashrc里增加以下几行: export http_proxy="http://proxy-server:3128/" export https_proxy="http://proxy-server:3128/" export ftp_proxy="http://

ubuntu/linux mint 创建proc文件的三种方法(二)

在做内核驱动开发的时候,可以使用/proc下的文件,获取相应的信息,以便调试. 大多数/proc下的文件是只读的,但为了示例的完整性,都提供了写方法. 方法一:使用create_proc_entry创建proc文件(简单,但写操作有缓冲区溢出的危险): 方法二:使用proc_create和seq_file创建proc文件(较方法三简洁): 方法三:使用proc_create_data和seq_file创建proc文件(较麻烦,但比较完整): 示例四:在proc文件中使用内核链表的一个示例(用的方

ubuntu/linux mint 创建proc文件的三种方法(四)

在做内核驱动开发的时候,可以使用/proc下的文件,获取相应的信息,以便调试. 大多数/proc下的文件是只读的,但为了示例的完整性,都提供了写方法. 方法一:使用create_proc_entry创建proc文件(简单,但写操作有缓冲区溢出的危险): 方法二:使用proc_create和seq_file创建proc文件(较方法三简洁): 方法三:使用proc_create_data和seq_file创建proc文件(较麻烦,但比较完整): 示例四:在proc文件中使用内核链表的一个示例(用的方