OpenWRT and a $4 USB Wifi Adapter

Early last year I managed to snag a bargain on a TP-LINK TL-WR703N v1 with an Atheros AR9330 for under twenty bucks. The router is about the size of a credit card with one ethernet and usb 2 port and it’s powered by a 5V micro usb cable. For less than $20 bucks I thought it was definitely a steal. The default firmware is Chinese as it’s a Chinese model, but flashing OpenWRT was as easy as using the inbuilt original firmware upgrader.

Fast forward to 2013, I’ve had it running now with dnsmasq (dhcp, dns server and dns based ad filtering) and running as a Wireless Client. As the device only has internal antenna I couldn’t use it as a Wireless repeater, so off to Ebay I picked up a $4 usb wireless adapter and a $1 Mini USB Bluetooth module (I’ll be using the Bluetooth module for my RaspberryPI and MSP430 Projects later). It still surprises me how low the prices have dropped on common technology.

Fast forward another 3 weeks my Wireless Adapters arrived from a Hong Kong seller. The adapter I bought uses the Ralink RT5370 chipset, so installing the required packages is quite easy once you recognize what is needed.

opkg update  
opkg install kmod-rt2800-lib kmod-rt2800-usb kmod-rt2x00-lib kmod-rt2x00-usb  

Unfortunately, one of the dependencies on the lib packages was a newer version of the kernel however the upgrade process was very seamless and was actually a lot easier than I thought it would be. Bellow are the commands for the upgrade, but if you are following this as a guide I recommend you double check the OpenWRT wiki first as often there may be issues with images etc. etc.

# Upgrade Firmware
cat<<'EOF' >> /etc/sysupgrade  

cd /tmp  

md5sum -c md5sums  
# 364/365 failed (so one passed, which is the one I downloaded)
sysupgrade -v /tmp/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin  

Now it should reboot after that, and we’re done with the upgrade :) Lets try the install of the USB firmware packages and hooray, they all installed without any issues.

opkg update  
opkg install kmod-rt2800-lib kmod-rt2800-usb kmod-rt2x00-lib kmod-rt2x00-usb  

Now we’ll backup and detect our new wireless config

mv /etc/config/wireless /tmp  
wifi detect > /etc/config/wireless  

Here’s an example of my wireless config file, I have my first wlan0 device setup as my Wireless Client and my new USB Dongle as a new AP repeater. So far so good, although the performance isn’t so great. I may have to do some further tinkering if it gets any worse.

config wifi-device 'radio0'  
        option type 'mac80211'
        option channel '3'
        option macaddr '00:00:00:00:00:0a'
        option hwmode '11ng'
        option htmode 'HT20'
        list ht_capab 'SHORT-GI-20'
        list ht_capab 'SHORT-GI-40'
        list ht_capab 'RX-STBC1'
        list ht_capab 'DSSS_CCK-40'

config wifi-iface  
        option device 'radio0'
        option ssid 'LINKSYSROUTER'
        option encryption 'psk2'
        option mode 'sta'
        option network 'wan'
        option key 'MYSECRETPASSWORD'

config wifi-device  radio1  
        option type     mac80211
        option channel  10
        option macaddr  00:00:00:00:00:00
        option hwmode   11ng
        option htmode   HT20
        list ht_capab   GF
        list ht_capab   SHORT-GI-20
        list ht_capab   SHORT-GI-40
        list ht_capab   RX-STBC1

config wifi-iface  
        option device   radio1
        option network  lan
        option mode     ap
        option ssid     MYHIDDENNETWORK
        option encryption psk2
        option key      SECRET
        hidden          1

Later on I’ll post up my other configs when I get the time to write them into a more presentable format, but until then have fun :)

comments powered by Disqus