How to turn your TP Link TL-WRT740N router into a fully functional one using OpenWRT
Recently i decided to acquire a full functional wifi router with as much as possible extra features like OpenVPN support, proxy running support etc. So i bought a very cheap and common TP-Link 150Mbps Wireless N Router TL-WR740N.
It comes with many features by default, but not the one I needed, so I flashed it with the OpenWRT firmware images. Here I will describe the whole procedure.
Hardware characteristics:
The one I bought for around $20 turned out to be v4.23. It has a 400Mhz Atheros AR9330 rev 1 CPU, 4MB Flash and 32MB RAM. More info can be found on its product page here.
Installing OpenWRT:
The TL-WR740N v4.23 works perfectly with the current unmodified Attitude Adjustment (12.09-beta) generic WR740N v4 and Attitude Adjustment (12.09 Final) generic WR740N v4 images. The best installation method is flashing it through the stock TP-Link web interface. So first download the openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-factory.bin file from the above links (the 12.09 Final preferred). If there is a newer version of OpenWRT at the time you read this, you may use it, but be sure to download the file ending in: -tl-wr740n-v4-squashfs-factory.bin, or you may effectively brick your router.
Note: Please reset your router to factory defaults if it has been previously configured/used.
- Power up your router device.
- Connect the local PC to any of the LAN ports of the Router.
- Browse to http://192.168.0.1 (alternatively you may use the URL – http://tplinklogin.net).
- Choose the menu “System Tools → Firmware Upgrade”.
- Upload the openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-factory.bin file to router. Be sure to chose a …….-squashfs-factory.bin file!
- Wait for the router to reboot.
- Make sure your router works ok as you unplug the LAN cable from your PC, plug it in back and browse to http://192.168.1.1
The OpenWRT firmware you’ve just flashed is a basic one and is missing the functionality i was talking about (like OpenVPN, proxying etc). So you need to prepare your own firmware and flash it over the generic OpenWRT firmware. Here is how you do it:
You will prepare the firmware image using Attitude Adjustment 12.09-beta ImageBuilder (r33312) or Attitude Adjustment 12.09 Final ImageBuilder. Since TL-WR740N v4.23 doesn’t have any stock USB, any USB stuff should be removed from the default generic OpenWRT firmware image. We will add the following functionality (incl. the web based configuration interface for them – LuCI):
- QOS (incl. LuCI support)
- OpenVPN (incl. LuCI support for Attitude Adjustment 12.09-beta r33312 only, ’cause in the 12.09 Final version it is broken)
- Tinyproxy (incl. LuCI support)
- UPNP (incl. LuCI support)
So, after downloading the Image Builder, extracting it, enter the extraction folder and then continue issuing the respective command:
For Attitude Adjustment 12.09-beta ImageBuilder (r33312):
make image PROFILE=TLWR740 PACKAGES="base-files busybox dnsmasq dropbear firewall hotplug2 iptables iw jshn kernel kmod-ath kmod-ath9k kmod-ath9k-common kmod-cfg80211 kmod-crypto-aes kmod-crypto-arc4 kmod-crypto-core kmod-gpio-button-hotplug kmod-ipt-conntrack kmod-ipt-core kmod-ipt-nat kmod-ipt-nathelper kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-netdev kmod-ledtrig-timer -kmod-ledtrig-usbdev kmod-lib-crc-ccitt kmod-mac80211 kmod-nls-base kmod-ppp kmod-pppoe kmod-pppox -kmod-usb-core -kmod-usb-ohci -kmod-usb2 kmod-wdt-ath79 libblobmsg-json libc libgcc libip4tc libiwinfo libiwinfo-lua libjson liblua libnl-tiny libubox libubus libubus-lua libuci libuci-lua libxtables lua luci luci-app-firewall luci-i18n-english luci-lib-core luci-lib-ipkg luci-lib-lmo luci-lib-nixio luci-lib-sys luci-lib-web luci-mod-admin-core luci-mod-admin-full luci-proto-core luci-proto-ppp luci-sgi-cgi luci-theme-base luci-theme-openwrt mtd netifd opkg ppp ppp-mod-pppoe swconfig uboot-envtools ubus ubusd uci uhttpd wireless-tools wpad-mini luci-app-qos luci-app-openvpn luci-app-tinyproxy luci-app-upnp"
For Attitude Adjustment 12.09 Final ImageBuilder:
make image PROFILE=TLWR740 PACKAGES="base-files busybox dnsmasq dropbear firewall hotplug2 iptables iw jshn kernel kmod-ath kmod-ath9k kmod-ath9k-common kmod-cfg80211 kmod-crypto-aes kmod-crypto-arc4 kmod-crypto-core kmod-gpio-button-hotplug kmod-ipt-conntrack kmod-ipt-core kmod-ipt-nat kmod-ipt-nathelper kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-netdev kmod-ledtrig-timer -kmod-ledtrig-usbdev kmod-lib-crc-ccitt kmod-mac80211 kmod-nls-base kmod-ppp kmod-pppoe kmod-pppox -kmod-usb-core -kmod-usb-ohci -kmod-usb2 kmod-wdt-ath79 libblobmsg-json libc libgcc libip4tc libiwinfo libiwinfo-lua libjson liblua libnl-tiny libubox libubus libubus-lua libuci libuci-lua libxtables lua luci luci-app-firewall luci-i18n-english luci-lib-core luci-lib-ipkg luci-lib-nixio luci-lib-sys luci-lib-web luci-mod-admin-core luci-mod-admin-full luci-proto-core luci-proto-ppp luci-sgi-cgi luci-theme-base luci-theme-openwrt mtd netifd opkg ppp ppp-mod-pppoe swconfig uboot-envtools ubus ubusd uci uhttpd wpad-mini luci-app-qos luci-app-tinyproxy luci-app-upnp openvpn"
The command line we used for the preparation includes all default packages of the default firmware images except: kmod-ledtrig-usbdev, kmod-usb-core, kmod-usb-ohci, kmod-usb2; and adds these packages: luci-app-qos, luci-app-openvpn (for Attitude Adjustment 12.09-beta r33312 only, ’cause in the 12.09 Final version it is broken), luci-app-tinyproxy, luci-app-upnp.
When the process ends, you should have all the needed files in the <extraction folder>/bin/ar71xx/ folder. From there you need only one file – the openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-sysupgrade.bin file. Use this file to upload it to your router and flash it with it using the LuCI interface. So follow these steps:
- Power up your router device.
- Connect the local PC to any of the LAN ports of the Router.
- Browse to http://192.168.1.1 .
- Login LuCI with the default user: root and password: password
- Choose the menu “System → Firmware Flash/Upgrade”.
- Upload the openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-sysupgrade.bin file to router. Be sure to chose a …….-squashfs-sysupgrade.bin file!
- Do not select to keep configuration files and click the Flash button.
- Wait for the router to reboot.
- Make sure your router works ok as you unplug the LAN cable from your PC, plug it in back and browse to http://192.168.1.1
- Telnet to 192.168.1.1 and set a new root password, or browse to http://192.168.1.1 and change the password from within LuCI.
- Proceed with the basic configuration of your router. You may use the relevant documentation on the OpenWRT site.
That is all. Now you have achieved the targeted extra features for your TP Link TL-WR740N v4.23
Note: If you are not comfortable with building your own modified image in the Image Builder, you may use the images I have prepared and tested. You can download them from here. Please use only the openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-sysupgrade.bin (12.09-beta) or the openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-sysupgrade.bin (12.09 Final) firmware images from there! The -factory.bin ones have not been tested, so you may effectively brick your router!
Serial cable for the TL-WR740N
If for some reason you brick your router and the failsafe mode of the OpenWRT firmware doesn’t work, you will need to debrick your router using a serial cable. Here is how you do it:
The v4.23 of the router uses the standard TP-Link pin-out, however the TX pin is not connected to the CPU. In order to make the TX line working, the two points on the bottom side of the PCB must be connected with a small wire. The pin at the SOC is labeled TP18, the one at the serial connector is labeled TP28. The RX line is 5V intolerant! So the connection needs a 3.3V RS232 level shifter. Pins on the connector of the board (look at the photos at the bottom of this post) are TX-RX-GND-3V3(VCC) (from left to right). After you solder all connections, you may use an USB to UART TTL convertor that you plug into your PC and use for example the cutecom application to connect to the /dev/ttyUSB0 device on your PC. Do not forget that you need to connect the TX pin of the convertor to the RX pin of the board and the RX pin of the convertor to the TX pin of the board. In case you use the USB to UART TTL convertor, you do not need to connect the VCC pin. Another important thing to do is to set the convertor to work with 3.3V if it can work both with 5V and 3.3V ! For more info look at the images at the bottom of this post.
After you are ready with your serial cable, you may proceed with the following steps:
- Put the original openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-sysupgrade.bin (12.09-beta) or openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-sysupgrade.bin (12.09 Final) to your TFTP server.
- Hook your router’s WAN Ethernet port up to your network/PC.
- Hook up the serial cable/console as explained in the section “Serial cable for the TL-WR740N“, start your cutecom application, open the /dev/ttyUSB0 device, fire up your router and send a “tpl” command when your router shows “Autobooting in 1 seconds” to get console access.
- Now we need to set router and server IP addresses (here named ROUTERIP and SERVERIP, substitute these with the real IP addresses). You’d better use these as IP’s: ROUTERIP->192.168.1.111 and SERVERIP->192.168.1.100. Type in the console (substitute as needed):
setenv ipaddr ROUTERIP
setenv serverip SERVERIP
printenv - Double check that the output of printenvlists the IP addresses you just set. Now we can load the firmware over TFTP with “tftpboot 0x80000000 openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-factory.bin”:
ar7240> tftpboot 0x80000000 openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-factory.bin Using eth0 device TFTP from server 192.168.1.100; our IP address is 192.168.1.111 Filename 'openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-factory.bin'. Load address: 0x80000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ###################################################### done Bytes transferred = 3932160 (3c0000 hex)
- Note the “3c0000” in the last line (your number may differ). Now execute the following commands, if necessary replacing 3c0000with the number you got from tftpboot:
erase 0x9f020000 +0x3c0000
cp.b 0x80000000 0x9f020000 0x3c0000
bootm 0x9f020000 - You’re set, OpenWrt should now boot and you can set it up as usual.
More resources on OpenWRT and TL-WR740N
If you need more info about all these, it is best to look at the official OpenWRT pages.
There is a specialized page about TL-WR740N there, so you can start with it first.
Final Notes
I have tested my TL-WR704N v4.23 router with Gargoyle and DD-WRT too, but I am not satisfied with the results at all.
- Gargoyle versions were 1.5.7 and 1.5.10, but they were almost twice slower than the OpenWRT version. The interface is really quite clean and is closer to a stock one, thus being suitable for novice Linux users that do not have that much knowledge about *nix as a whole. And though Gargoyle has some additional nice features, they do not really worth it. You should also have in mind that it has no OpenVPN support in the firmware for this specific model.
- DD-WRT was a testing version 10-12-12-r20119-testing, and it was supposed to work ok, but actually it bricked my router, so I needed to go to the serial console to fix it. In a word, i would not advice you to test DD-WRT at all, if you are not prepared for de-bricking 🙂
Photos of TL-WR740N
- TL-WR740N v4.23 case front
- TL-WR740N v4.23 case back when opening
- TL-WR740N v4.23 case back
- TL-WR740N v4.23 board front
- TL-WR740N v4.23 board back
- TL-WR740N v4.23 board back with pin layout
- TL-WR740N v4.23 board back with serial cable soldered
- TL-WR740N v4.23 with a serial cable in the case
- USB to UART TTL gadget