OpenWRT

I’ve been using various consumer routers hacked with dd-wrt both at home and on campus for years, and was shopping for a new one to use in the apartment I’ll be moving in to in a couple weeks, only to discover that the desired feature set wasn’t possible with dd-wrt. In particular, I wanted 802.11n, Gigabit Ethernet, USB printer sharing, and the ability to share an ext4-formatted USB hard disc via SMB and SSHFS. Hardware with the requisite bits isn’t too hard to come by, but no stock firmware supports the range of printer and storage features I wanted (and most of them are missing basic features and/or just plain suck). DD-WRT isn’t a solution, because it uses ancient kernels that don’t support modern file systems. I figured since OpenWRT was well spoken of and claimed to do everything I wanted when coupled with suitable hardware I would give it a try, and picked up a TP-Link WL-1043ND based on reviews and price, and followed the Wiki Instructions to flash it from the web interface.

This turns out to have been an excellent decision, because not only are the basic packages in OpenWRT a good five years newer than in in DD-WRT, it turns out to be superior in virtually every way. The OpenWRT documentation isn’t as inviting as DD’s, but the install process is no more complicated, the Web GUI is better laid out and more responsive, and features can be easily added and removed with a well-designed, well-integrated package manager (opkg). I’m aware that DD-WRT supports ipkg, but it has always felt hacked on and never worked terribly well for me, but opkg just works on OpenWRT. It even has a friendly Web interface for managing packages. Even the warning about the stock WL-1043ND image not coming with the appropriate WiFi modules is apparently out of date, because everything was already in place.

It took me about two hours of fiddling to get acquainted with OpenWRT’s way of doing things, and check that all the features I wanted worked. Not only did I get everything I wanted working (at least as far as a quick test could pick up), but the way OpenWRT handles configurations is excellent – things in /etc/ are generally temporary, things in /etc/config are well-structured components of their Unified Configuration Interface, which can be manipulated by hand or via the Web interface, and will be used overwrite other configurations on reboot. It reminds me of the old Red Hat /etc/sysconfig routine, but done well.

Once I decided OpenWRT was cool, I also fixed the old Netgear WGT634U we had lying the lab up with it to use for experimenting. We got it from a mesh networking experiment some folks from MIT were running at SC a few years ago, in exchange for setting it up in our booth during the conference running an early roofnet firmware. Unfortunately, that ancient roofnet firmware is basically useless without peers, and hard to get rid of because it doesn’t have an online upgrade process. The OpenWRT wiki indicated that it was possible to overwrite via Serial+TFTP, so, I grabbed a suitable OpenWRT image, pulled the router apart, hooked up my BusPirate in Transparent UART Bridge mode to the pins as indicated in this OLD wiki article, and surprisingly straightforwardly made it happen. Sadly, I failed to take a picture while I had it apart.

Just to document for clarity to make things repeatable, the serial port is a four pin header silkscreened J7, which will likely be the only populated header, the pin furthest from the LAN ports is GND (Connect to BusPirate GND), the next furthest is RX (Connect to BusPirate MOSI), and the second closest to the LAN ports is TX (Connect to BusPirate MISO). The pin closest to the LAN ports is an unneeded Vcc (3.3V?).

I then followed the instructions, held Ctrl+C while plugging the router in to interrupt boot and get the CFE> prompt, issued ifconfig eth0 -auto to pick up a DHCP address from the upstream router plugged in to the WAN port, flash -noheader $IP_OF_TFTP_SERVER:$PATH_TO_IMAGE.bin flash0.os to grab the firmware off a TFTP server spun up on one of my machines, and let it do it’s thing. It came up in OpenWRT exactly as expected after issuing a reboot, and actually sent useful information about OpenWRT setting itself up down the still-open serial session.

The only additional difficulty was that the warning in the wiki about this one not coming with the right WiFi modules was correct – it comes with the bcm43 stuff for the part that was typically paired with the chipset, while this particular router has a ath5k-based minipci card in it instead. A quick pass through the web interface package manager front-end (so cool that there is one of these in an embedded distro) to add kmod-ath5k and remove kmod-b43 and kmod-b43-legacy, a reboot, and wifi was online.

Luci (OpenWRT’s web interface) does seem to be missing a handful of things that are obvious in dd’s, like an easy way to set the DHCP range independent of the router’s internal IP, but the combination of better organization and responsiveness, and the simple fact that there are sane, accessible, well-structured configuration files for everything on OpenWRT largely makes up for the lapses.

I recall historically that DD-WRT was kludged out of the GPL compliance sources for the WRT-54G and an independently developed fronted, then had some core developers shut everyone else out of some core components, eventually turning it in to a commercial project (pissing off a big chunk of their community in the process – I remember seeing the mailing list spats). Contrast that with OpenWRT, which was apparently designed from the ground up as a distribution for embedded Linux machines and has remained fully open, and it isn’t terribly surprising that OpenWRT is in better shape. Someone else’ version of the story can be found here.

This entry was posted in Computers, DIY, Electronics, General, Objects and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *