This blog post listed Linux Compatible USB wireless adapters. It seems that many new Linux users frequently has problems learning how to install RT2870 driver under Linux. I also received email requesting installation instructions for the same device. This quick tutorial would explains how to install RT2870 based chipset device with WPA2 authentication and TKIP wireless en Cryption.
Our Sample Setup
The following instructions is tested on:
- Ubuntu Linux 10.04.1 LTS
- Kernel-linux 2.6.32-24-generic-pae i686 (+ bit)
- WPA2 with Linksys 160N router
RT2870 Chipset Based Devices is not working out of Box
The main problem is conflicting driver which be shipped with default kernel. WPA2 is a method of security wireless networking with optional PSK for home users. The default driver only recognizes driver and 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 rt2800usbblacklist rt2x00libblacklist 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, you can compile source code:
$ sudo apt-get install build-essential fakeroot dpkg-dev
Finally, install Linux kernel headers So, 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, Network Manager can is used to set WPA2 auth info:
$ vi os/linux/config.mk
Set it as follows:
# support wpa_supplicanthas_wpa_supplicant=y# support Native wpasupplicant for Network mangerhas_native_wpa_supplicant _support=y
Save and close the file. To compile the driver, enter:
$ make
Sample outputs:
Make-c toolsmake[1]: Entering directory '/tmp/2010_0709_rt2870_linux_sta_v2.4.0.1/tools ' gcc-g bin2h.c-o bin2hmake[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/bin2hcp-f os/linux/makefile.6/tmp/2010_0709_rt2870_linux_sta_v2.4.0.1/os/linux/makefilemake-c/lib/modules /2.6.32-24-generic-pae/build subdirs=/tmp/2010_0709_rt2870_linux_sta_v2.4.0.1/os/linux modulesmake[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_rt287 0_LINUX_STA_V2.4.0.1/OS/LINUX/RT2870STA.KOMAKE[1]: Leaving directorY '/usr/src/linux-headers-2.6.32-24-generic-pae '
Note:you 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 installmake[1]: Entering directory '/tmp/2010_ 0709_rt2870_linux_sta_v2.4.0.1/os/linux ' rm-rf/etc/wireless/rt2870stamkdir/etc/wireless/rt2870stacp/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-paemake[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 this Wireless USB LAN adapter is detected:
$ lsusb
Sample outputs:
Bus 002 Device 007:id 0411:00e8 MelCo., Inc. Buffalo wli-uc-g300n Wireless LAN adapterbus 002 Devic E 006:id 05ac:0220 Apple, Inc. aluminum Keyboard (ANSI) Bus 002 Device 005:id 05ac:1006 Apple, Inc. Hub in aluminum Keybo Ardbus 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 hubbus 002 Device 001:id 1d6b:0002 Linux Foundation 2.0 root Hubbu S 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 Blu Etooth) Bus 001 device 003:id 0a5c:5800 Broadcom Corp. BCM5880 Secure Applications Processorbus 001 Device 002:id 8,087:00 Intel Corp Integrated rate Matching hubbus 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 the If you want WPA2 based authentication):
Authmode=wpa2encryptype=tkipwpapsk=your-password-here
See Readme_sta for other detailed information on 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 the computers, one below to the other on the Left-side). Clicking on Nm-applet would give you the types of connection/hardware you has available > Se lect Wireless device > select nixcraft SSID (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 : 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.
Ubuntu linux:install RT2870 Chipset Based USB Wireless Adapter (RPM)