Ferdinand Keil's

electronic notes

Jan 22, 2013

Use the TP-LINK TL-WR703N as a WiFi client with OpenWrt

I recently bought a TP-Link TL-WR703N router on eBay to connect one of my projects to the net. The router arrived today, just 18 days after I ordered it from China. I need it to operate as a client in my wireless network, so after I successfully installed OpenWrt I had to configure it accordingly. These are the steps I followed:

Warning: Don't follow these steps if you're not familiar with OpenWrt or Linux. These instructions are provided "as is", without warranty of any kind.

Step 1: Install OpenWrt

Download the latest firmware for the TL-WR703N. To install it, connect the router to your PC via wired network. The (Chinese) admin interface is available at 192.168.1.1, so configure you network settings accordingly. To flash OpenWrt first rename the downloaded file to openwrt.bin (the router seems to have problems with long file-names). Then login to the admin interface (username: admin, password: admin) and select the last menu item in the row to the left (but not the one below), then the third sub-menu item. Click on the button right to the text-field and select the firmware file. Click on the button in the bottom left corner and wait till the router reboots (LED is off, then flashing while reboot).

Source: OpenWrt Wiki - TP-Link TL-WR703N - Flashing

Step 2: Configure the IP-Address

When the router finished rebooting open the OpenWrt admin interface in your browser (again at 192.168.1.1). To ease the further steps we will now change the default IP address of the router. Go to Network - Interfaces - LAN and click "Edit". Change "IPv4 address" to one that lies in the subnet your (main) router is in. Then change "IPv4 address" and "Use custom DNS servers" to your (main) router's IP address. Check "Ignore interface" and save and apply the settings. Then go to Network - Interfaces - WAN and click "Edit". Check "Ignore interface" and save and apply the settings. You still have to set a password for OpenWrt. Do that by clicking on the link shown in the red warning. Enter a password, repeat it and save and apply it. Then go to Network - DNCP and DNS - General Settings, set "DNS forwardings" to your (main) router's IP address and save and apply. Now connect the TL-WR703N to your (main) router via wired network.

Step 3: Install packets and configure network settings

Point your browser to the IP address you've given to the TL-WR703N (if that does not work, power-cycle the router). Then go to System - Software and click on "Update lists". Now install the following packets: relayd, luci-proto-relay and joe. To install them, enter their name into the text-field labelled "Download and install package" and click on "OK". Now open PuTTY and point it to the router's address. Login and type

cd /etc/config/ joe network

and change the file, so it looks like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'``

config interface 'lan'
    option ifname 'eth0'
    option type 'bridge'
    option proto 'static'
    option netmask '255.255.255.0'
    option ipaddr '192.168.1.1'
    option gateway '192.168.2.1'
    option dns '192.168.2.1'

config interface 'wwan'
    option _orig_ifname 'radio0.network1'
    option _orig_bridge 'false'
    option proto 'static'
    option ipaddr '192.168.2.200'
    option netmask '255.255.255.0'
    option gateway '192.168.2.1'
    option dns '192.168.2.1'

config interface 'stabridge'
    option proto 'relay'
    option ipaddr '192.168.2.201'
    list network 'lan'
    list network 'wwan'

Notice:

  • The IP-address under lan - ipaddr must not be in the same subnet as your (main) router.
  • The IP-addresses under wwan - ipaddr and stabridge - ipaddr must be in the same subnet as your (main) router.
  • The IP-addresses under wwan - gateway and wwan - dns must be your (main) router's IP-adress.

Save the changes and exit joe by pressing Ctrl-K and X. Then enter

joe wireless

and change the file so it looks like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
config wifi-device 'radio0'
    option type 'mac80211'
    option macaddr '00:00:00:00:00:00'
    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'
    option disabled '0'
    option channel '1'

config wifi-iface
    option network 'wwan'
    option ssid 'YOUR-SSID'
    option encryption 'psk2'
    option device 'radio0'
    option mode 'sta'
    option key 'YOUR-PSK-KEY'

Notice:

  • Don't change *radio0 - macaddr*!
  • YOUR-SSID has to be your (main) router's wireless SSID, YOUR-PSK-KEY the passphrase for the network.

Again, save the changes and exit joe by pressing Ctrl-K and X. Close the SSH connection by typing "exit".

Now disconnect the network cable and power-cycle the router. It should now be available through its wireless connection. Check it by entering the IP you've given to it in the browser. If you have problems, you can connect the device to your PC and point your browser to the address you've given to the "LAN" interface (configure your local LAN settings accordingly). If everything else fails, you can enter the failsafe mode by following the steps in the OpenWrt wiki.

Source: OpenWrt Forum - TP-Link TL-WR703N - how to configure it as a wirelesss client

Step 4: Install the Bootstrap theme (optional)

I don't like the default theme OpenWrt uses for the admin interface. David Menting, a Dutch industrial designer has created a nice alternative called the OpenWrt Bootstrap theme. Built upon Twitter's Bootstrap framework it offers a much more up-to-date look and feel. To install it, connect to your TL-WR703N via PuTTY. Then enter the following commands:

cd /tmp
wget http://nut-bolt.nl/files/luci-theme-bootstrap_1-1_all.ipk
opkg install luci-theme-bootstrap_1-1_all.ipk

Now you can select the theme in the admin interface. Go to System - System - Language and Style and select "Bootstrap" from the dropdown menu labelled "Design". Apply and save, click any link and enjoy the warm, fuzzy feeling of a modern web-application :) Although this step is optional I still highly recommend it.