”’Flashing firmwares is dangerous”’ and installing third-party firmwares like OpenWRT is unsupported by your router manufacturer. There is a possibility of “bricking” or killing your router, so if you aren’t in a position to cope with this – don’t even consider trying any of this.
When I tell people that I have a Linux machine acting as the router in my household, I get some strange looks and get told that they’d sooner have a “real router”. What they don’t realise is that except for some incredibly expensive hardware firewalls, most routers run Linux anyway – just hidden behind the cloud of a fancy web interface.
While researching for my piece on Winamp Remote/Orb, I came across a project called OpenWRT. This is essentially an open source Linux distribution for embedded devices, designed to fit into a small memory foot print. It was originally developed specifically for the Linksys WRT54G router, but very quickly other devices were discovered to be compatible – most of them use the same Broadcom processor, but some other processors are also compatible.
The idea behind OpenWRT is to open up functionality that wasn’t originally available, but also to provide a Linux frame work, for customising your device to do far more than it was originally designed for.
We managed to get hold of a LinkSys WRT54G only to discover it was the fifth generation, and no longer compatible with the OpenWRT project. Something to be wary of if you are following some of the older guides around the Internet.
Searching around the office cupboards, I came across the Buffalo Airstation WBR2-G54, which happened to be on the supported hardware list. It has a 200MHz Broadcom processor, 4MB of flash memory, and 16MB of RAM.
For what I wanted to do, I also used the Buffalo Terastation. My target was to get a BitTorrent client going and a web based access system for the Terastation.
Installing OpenWRT is usually a case of just selecting the OpenWRT image in the same way you would upgrade using an official firmware. However, in this case, I had to use TFTP in order to do so. This method is worth reading about, as it can be used for de-bricking a router. When turning your router on, there is a five second interval in which you can intervene and upload the new firmware.
At first, I used the straight forward OpenWRT build, which comes with a limited web interface.
With no setting up at all, I had a fully functioning router, on OpenWRT. I could SSH into the router, and adjust anything I wanted to and tweak things to my needs.
I very quickly realised that the web interface was limited. And I found myself diving into the console to get things done. Not a huge problem, but certainly for people with less Linux knowledge, a web interface can be nice. A project that is run alongside OpenWRT is X-Wrt. Instead of installing this over the top of my OpenWRT image, I just downloaded a pre-made firmware with X-Wrt already installed.
X-Wrt has so much more functionality, such as the ability to organise your firewall rules (instead of editing them manually in a text file). However, it does use up more space on the device.
What makes OpenWRT very userfriendly and quick to deploy, is the “ipkg” package system. Porting software to OpenWRT is hard work, especially when trying to keep the footprint as small as possible – so leaving this to other people kind of makes sense.
Once you’ve set up your package repositories (the default is the official OpenWRT), then you can find pretty much anything you need.
It’s also very quick to remove any packages that you don’t think you’ll need. I installed kmod-cifs and cifsmount, so that I could mount the Terastation on the router’s local file system. The same principle applies for any SAMBA/Windows Share.
I added the following line in to my startup scripts, via the web interface.
”“/sbin/mount.cifs //192.168.0.11/share /mnt/terastation -o guest””
192.168.0.11 is the IP address of the Terastation, and /mnt/terastation is a folder I made previously.
I then rebooted the router, so that the cifs Kernel module could be loaded, and the new startup script executed.
To access this, I needed a web browser interface. This turned out to be much more annoying than I originally intended. Although OpenWRT uses BusyBox, getting this to work with PHP was very difficult indeed, constantly coming up against issues. Today, a new version of BusyBox was released, with new features that might aid this, but this new version hasn’t been ported to OpenWRT yet.
I did have limited success using the built in webif-page CGI wrapper, to get PHP working. Using this and one of my favourite simple PHP scripts, File Thingie. This is a single PHP file, that will you give you browsing capability of a folder (such as our Terastation), including ability to upload files.
However, although I had limited success – implementing it took modification of the original code and certainly wasn’t a walk in the park.
Believe me, I spent hours trying to get this working, and although it is possible to get lighthttpd+php working, I kept running out of space and frustration got the better of me.
The last thing I wanted to do, was set up a BitTorrent client, so I could leave torrents downloading straight to the NAS box, without having to keep a power-hungry PC going overnight.
In the ipkg system, Enhanced Ctorrent is available. This is a console BitTorrent client and works fine. However, it’s not ideal to have to SSH into the router every time you want to set a torrent to download.
I came across CTCS – Ctorrent Control Server. This is a web front end for Ctorrent. This is written in Perl, and despite my best efforts to get all the relevant libraries from a full Perl install, I couldn’t get it to work with the microperl ipkg.
OpenWRT, with the X-Wrt web interface, makes for an excellent replacement firmware, even you never intend on customising it. However, if you have the time and the patience, OpenWRT can be made to do some amazing things. Just looking around the OpenWRT forums, I see evidence of some great projects that are working.
Some routers even have USB ports, enabling many possibilities. At under £100 for one of these routers, they suddenly become cheap Linux project boxes.
I spent over two solid days working with OpenWRT, and although getting very close, I also got incredibly frustrated and didn’t achieve what I set out to. I do feel, that given enough time, I could have at least got a PHP web server up and running, even if I had to resort to using lighthttpd.
I was disappointed that the dropbear SSH server included doesn’t support tunneling as standard, and needs recompiling to support it. With an SSH connection, one can tunnel ports from anywhere on the local network to an external source for access. However, it does fully support OpenVPN, which would give the same functionality.
Unlike other sites, we thoroughly test every product we review. We use industry standard tests in order to compare features properly. We’ll always tell you what we find. We never, ever accept money to review a product. Tell us what you think - send your emails to the Editor.