Install OpenWRT on TPlink WR703N

From XinCheJian
Jump to navigation Jump to search

Install OpenWRT on a TP-Link WR703N

This tutorial aim to install and run the Open WRT distribution on a TP-Link TL-WR703N.

Open WRT

Open WRT is a light distribution aim to be install on modem and wifi routers. This distribution is free and open-source, and have a strong community of hackers, developers using it. You can find more information here : Open WRT wiki


TP-Link WR703N

The TP-Link router is a small wifi hotspot, with a USB port that make highly customizable. Moreover, this unit cost less than 100RMB on your favorite online shop!

  • Specifications :
    • Atheros AR7240 CPU (400Mhz)
    • Atheros AR9331 Chipset (integrated wireless)
    • 802.11 b/g/n 150Mbps (130Mbps real)
    • wireless power output 20dBm - 100mW
    • 4 MB flash memory
    • 32 MB RAM
    • Tiny form factor: 5.7cm x 5.7cm
    • 1x LAN port
    • 1x USB 2.0 port
    • 1x mini USB port, for power
    • 1x LED (customisable once OpenWRT is installed)

How-to install Open WRT ?

This guide is intented to be for total beginner, with all the code to write.

/!\ Before starting, you need to download the latest version of OpenWRT for the TP-Link router here : http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin /!\


Linux

Our Linux version is Ubuntu 12.04 LTS, up-to-date, with Firefox 13.0.1

Plug it! And install

You first need to plug the router on your computer, using an ethernet cable, and the mini-usb cable provided in the router's box. Open your favorite internet browser and connect to http://192.168.1.1/. A pop-up appears and you have to enter the login:admin and password:admin. You will arrived on the administration interface. But horror! It's all in Chinese! If like 1/4 of the mondial population you don't read this beautifull language, don't run to your closest Chinesse class, but look on the left for this button (Even if having a chinese class still is a good idea): Screenshot from 2012-06-28 21 57 30.jpg


and then 软件升级 to get this screen: Screenshot from 2012-06-28 21 58 37.jpg


Click on the upload button (TRANSLATION OF upload IN CHINESE), select the openWRT file previously downloaded (here if you missed it, but you might have to disconnect the TP-link to have an Internet access again) validate ( on the left corner TRANSLATION OF validate IN CHINESE ), and confirm on the pop-up screen.


Screenshot from 2012-06-28 22 12 44 bis.jpg

Then wait until the router reboot.

/!\ Do not turn off the router, your computer, or disconnect any cables at this point, or you will risk to block you router (and you don't want to do that...) /!\

When the upload is done, the administration interface should be gone.

Configure OpenWRT

To configure the distribution, you need to open Terminal, and type:

 telnet 192.168.1.1 

You should get this screen : Screenshot from 2012-06-28 22 22 49.jpg

Which means that your distribution is successfully installed. You now need to secure your connection, by typing:

 passwd 

And follows the instructions to set your password.

Now, everytime you will want to connect to your router, you will have to use a ssh connection:

 ssh root@192.168.1.1 

The next thing you will want to be is probably to connect your freshly hacked router to your wifi network, to be able to update it and have an wireless access to it ;)

Configure Wifi

The material configuration file are in /etc/config, so you need to edit it first.

 vi /etc/config/network 

then edit the file by pressing 'i', and adding the following lines:

 config interface 'wan'
        option ifname 'wlan0'
        option proto 'dhcp'

To save, press 'esc' to be sure to be out of the edit mode, and then type:

:wq 

Now we need to edit the configuration file to connect to your network:

 vi /etc/config/wireless 

You should have this screen: [SCREENSHOT]

Edit the file by pressing 'i'. You need to comment the line 'option disabled 1' by adding '#' in the front of the line. Then edit the existing configuration:

 config wifi-iface
              option device radio0
              option network wan
              option mode sta
              option ssid '''Your network name here'''
              option encryption psk
              option key '''Your network password here'''

You need to change the ssid and the key according to your own network. The encryption here correspond to WPA, please refer to OpenWRT wiki for other configuration: http://wiki.openwrt.org/doc/uci/wireless

When it's done, press 'Esc' to quit the edit mode, and type:

:wq

to save the modifications and quit the file.

You need now to reboot the device:

 reboot 

After the reboot, your router should be connected to your wireless network. If not, check the configuration files again ;)


GUI Luci

Now that we have a wireless connection, most of the users will want to have something more... simple and intuitive to use the network functions or the router. Use ssh to connect to the router:

 ssh root@192.168.1.1 

then update the packages, and install Luci without HTTPS support

 opkg update 
 opkg install luci 

and then enable and start uHTTPd (it will restart too at every reboot):

/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start 

After that, you should be able to connect to your router with your web browser on this address : http://192.168.1.1 The password is the one you set at the beginning, same one you use for the ssh connection!

Et voila! Your router is connected, configured, and you can start messing with it ;)

WAIT! BEFORE YOU MESS WITH IT

install this package:

opkg install restorefactory

it'll save you a lot of pain!


Troubleshooting

It can happen, that for an unknown reason, the router turn to a failsafe mode (Mostly when you fully fill the memory...). This mode is recognizable by the blinking LED (same speed that when it's supposed to boot). In this mode, the router is no more accessible by ssh. Don't panic, we have the solution:


Connect through Failsafe mode

Configure your computer on IP 192.168.1.2, with netmask 255.255.255.0 (no gateway), connect your router by ethernet, and plug the usb power. When the LED start blinking ( after around 10 seconds ) press the reset button. The LED will blink fast, and you can connect to your router with the command:

telnet 192.168.1.1

Then enter to the JSSF2 read-write mode:

mount_root
  • You can then restore the router to factory settings, with the following commands (I don't know which one exactly, try them'all!):
firstboot

or

mtd -r erase rootfs_data

or

rm -r /overlay/*

Done! You can now exit the failsafe mode, and reboot the router:

reboot -f

Your router should be accessible again, via ssh or telnet, and you can start back to #Configure OpenWRT! :D Good Luck!

More informations

More informations on Luci : http://wiki.openwrt.org/doc/howto/luci.essentials

More informations on OpenWRT :http://openwrt.org/

Credits to BitArtist.org from where most informations come from ;) http://www.bitartist.org/2012/02/motion-tracking-on-wireless-router.html