OpenWRT on TL-MR3420


Personal computers are great. You can save all your data in one place and search it out with ease. Though cloud computing would be the next big things, we are still waiting for that kind of bandwidth.

I was showing off to dad how OSX indexes everything on my MBP and CMD+Space, is all I need to do to find whatever I want to find. I found some scanned documents and dad was excited - ‘ It would be very convenient to be able to search all movies, documents, music this way, siting on any networked device in the house.’ So I implemented Wake-On-Lan on the desktop and since it runs Hakintosh, Bonjour allows easy access to the shared space. But the desktop is a Core i7 monster, and eats power like a hungry Snow Leopard ;-) .

So NAS with print-server is the next obvious solution. For now, it’s an expensive deal.

We own a TL-MR3420 3.5G router, which has a USB port to connect a 3G USB MODEM, and share it over WiFi a/b/n. But the firmware from the company allows only and only a few 3G MODEMs to connect to the USB port. I have one and it works well, but I want to use that USB port for other things - namely a USB-SATA HDD.

I found Open-WRT and it supports my router. It allows using the USB port anyway one wants to use the port. I was excited. Simply put, OpenWRT is like the jailbreak for the router. It’s an operating system, which supports a hell lot of routers in the market. It’s basically a small footprint Linux, which is nothing out of the blue, since most routers run Linux.

I dusted my old WiFi router, TL-WR642, and made it active, so that the internet in the house is not disturbed.

Next was the easy step, I downloaded the X-wrt version of the firmware from , for my router and uploaded it using the Web-GUI of the router. In a minute I was in the free land of OpenWRT!!!

It was tough to start with. X-WRT is fairly complicated, and iptables has forever freaked me out, even during my grad courses!

I managed to change the router’s LAN(eth0) IP from to by going to Network - > Networks and changing the IP in the lan section.

*The important thing is to press the Save button at the bottom left and then PRESS THE “APPLY CHANGES” link. If you don’t press apply changes, the changes are not committed, a mistake I made too many times initially. Also it takes a fair amount of time to commit changes, so be patient.

Similarly WiFi (wlan0) is easy to turn on - goto Network->Wifi and enable the radio and set the preferences like SSID, password, etc. The ‘range in meters’, was an odd looking settings, so I left it. You also have to enable the lan-bridge, by going to Network->Networks and set lan network type to bridged. This starts the DHCP on the WiFi also.

Next setup the wlan interface (eth1) to connect the router to another router+modem (in my case) or just a DSL Modem, as the case may be. The settings are under Network->Networks-> wlan. It you want NAT between lan and wlan (which you obviously do), you need to setup a static IP for the WAN and give the DNS also manually, as the Open-WRT would need to connect to the internet to get packages.

Next was to get the internet over the LAN. Or in simple words, getting NAT to work. I thought this should have worked by default, I even tried a few things in the webUI, but no internet on the LAN/Wifi. So I had to get my hands dirty using iptables!

Here are the two commands I used, which I found here -

iptables -t nat -I postrouting_rule -s -d -j SNAT --to

iptables -I zone_lan_forward -s -d -j ACCEPT

Where: is the LAN subnet/mask. is the IP of the Modem+router is the static IP you setup for the wan interface

(Please change the IP address according to your networks)

These have to put inside /etc/firewall.user

So everything was up.

Next was to do that for which I had put up OpenWRT primarily for, i.e. USB port for Mass Storage Device. It’s fairly simple to do, as explained in - and then

But, this was where I got stuck, I just could not install packages. I figured out that the problem was that the package list was meant for a more recent kernel than I was using. I also pin-pointed the problem to having installed the X-WRT version of the firmware, which had the older kernel. The obvious next step was to use the other firmware, without the webUI. I installed it, without much problems. The packages started to come. Thank God I saved the settings at the time of updating the firmware, otherwise, it would have been very difficult setting up the WiFi and some other things again, without the webUI.

I got the USB pen-drive and my SD card (via a Transend card reader) to be available as sda1 on the router. I mounted them, wrote a file to it and was more than happy! Then came the fact that I had to share this over the LAN, for which i needed a network share, and a server to host that. The choices in OpenWRT are Samba ( or NFS ( This was the finishing punch to my efforts. I RAN OUT OF SPACE. Yes, the router has a mere 4MB and Samba or NFS cannot be installed in that space along with the USB storage system. I tried to remove some other nonessential things, but I could not get any of them. I could have installed sshfs ( and I think it would have worked, but that would not be the best thing, as I would need a lot of extra software on the PCs to allow them to see that share. So I left that, there.

Now since I didn’t have the webUI and the only way I knew of changing the firmware was the webUI, I was scared dead, wondering how to restore the OEM firmware. I came to this( and used the MTD method and it worked flawlessly.

I was back to square one, but having ventured into a new space. It was 3:30 in the night and I went to bed.

In the morning I did some more reading. One can install packages into external drives, like the USB drive I mounted. That means I need the device plugged into the router, forever. Moreover, since the router cannot give more than 100mA from the USB port, I can’t run a portable HDD off it directly, I need a powered hub, which costs roughly $20. At $100 to $150 I can get a NAS with a 1TB HDD inside and print server option. So it’s not really cost effective. If I had a externally powered USB HDD, maybe, I would have made it work.

I hope this helps someone setup OpenWRT quickly, at least with the TL-MR3420 and the configuration, which I aimed for and almost did.



P.S. it’s a lot technical and no screenshots, as I aim it for people knowing what they are doing and a fair knowledge of linux.


ravi said...

just how did you land up with as the modem ip address? this is a self assigned ip address -

took me a long time to figure that out.

Akshat said...
This comment has been removed by the author.
Akshat said...


Yes you are right, 169.x.x.x a free subnet. Actually it's copied from the wiki page directly, so I didn't give it much thought then.

In my configuration, 169.x.x.x happens to be 192.168.1.x. and 192.x.x.x happens to be 10.64.1.x.

Let me explain-
At my home, the router+modem provided by the ISP issues a single DHCP address(as per plan), that is to the Wifi router in the house (MR3420). The Wifi router then allocates the DHPC address in the larger (usable, but not used) subnet of 10.64.1.x.

The reason for choosing 10.64.1.x is that 10.64.x.x is the subnet at my work place and keeping the similar subnet allows me to configure some IP dependent network services to work at both home and office.
Though this is not much of a problem, now that I've setup separate "Locations" on my Macbook Pro, so that when I select the home/work location, default wifi network, lan printers etc change accordingly.

I hope I was able to put my thoughts clearly.



ravi said...

what does "a single DHCP address(as per plan) mean?

what is the ip address out the modem /router ?
does the MR3420 have 2 ips ?

what about a network diagram ?

Akshat said...

I finally got time to reply.

Well the "single DHCP address as per plan", means that even thought the "router+modem" runs a DHCP server, it allocates only one DHCP address, i.e. to the MR3420.

Yes the MR3420 would have two IP address in two different networks, like any other router, it would be more clear in the network diagram below.

<192.168.10/24>(MODEM+ROUTER Network) |MR3420|
<>(Home Network) |PC/Laptop/iPod/iPad/Elm|

<> = IP/subnet
| | = Device
( ) = Network Scope

The IP address on top and bottom represent the two interfaces of the router devices.

I think I should put some time and write a post on the network I've setup at my place. With OpenDNS, firewall, bonjour, Wake-on-LAN, wifi-N issues with Apple devices, etc, etc. (Soooon )



ravi said...

a diagram - go to or some such site and make a network diagram. text <> diagram

Akshat said...

True and thanks for sharing. But, photos are not allowed in comments on blogger. So well.

Incidentally, I use Open Office Draw for drawings. Or Dia in Ubuntu.


Alessandro Tanino said...

Well it really looks like my last Sunday (yesterday) spent on it :-)

I could use extroot to have some more space in order to install luci gui, nfs, samba, filesistems support and so on a usb pen drive (ext4) formatted. The only things you need on the flash is the support to mount the usb drive (ext4, usbcore, ehci and so on).

I want to connect an external hdd, that is seen by the router if directly connected, but it isn't if connnected through a usb hub. I really hope the only problem is the missing power to the usb hub... I will try to provide the power to the hub (connector available on the hub).

The surprise is that the powered 3.5" drive is not working through the passive usb hub, while it's seen if directly connected (no usb key then, so no filesystem support).

The next step is to try to put the power to the usb2 hub, or change the usb hub. Then connect hdds, usb pendrive (for extroot/flash extension), and usb 4g umts key to the powered hub...


Akshat said...

Dear Alessandro,

First of all congrats for your success and thanks for posting.

The powered 3.5" drive should work. Have you tried two pen-drives using the hub? Which would prove that the USB port behind the router, takes two devices at ones (which it should, it's USB).