Most people think of their home router as simply the little black box with the flashy lights that provides the house with internet. They’d be correct, but there is whole lot more that those black little boxes can do. It is possible to run an embedded version of Linux on selected (mainly Linksys) models. This means that you can make your router perform the same tasks as a dedicated Linux server in your network, at a fraction of the energy costs. This whole project started when Linksys where required to release the source code to their firmware under the terms of the GNU GPL.
The two major versions of Linux firmware available for routers today are OpenWRT and DD-WRT. OpenWRT is the most powerful of the two, but is mainly command line based. This makes it more suited to embedded systems. DD-WRT has the best Web Interface of the two, and it more suited to replacing stock firmware on home routers. People want a nice WebUI when something goes wrong, not looking at /var/log/messages on a terminal.
OptWare is a lightweight package system that originated on the NSLU2 Unslung system, but has since become the de facto standard package manager for embedded Linux systems. DD-WRT does not support these packages by default, but can be easily configured to support them. The OptWare package library contains lots of applications that people may already have heard of such as MySQL, Transmission, Asterisk, OpenSSH, Apache, nginx, PHP and Vlc.
If you plan on installing OptWare packages on your router, you will require space to store them. Most routers have lots of RAM space but little NVRAM. The difference being, that the latter does not lose its contents when the power is lost. Clearly, having to reinstall your applications to RAM on every powerup is not going to work in the long term. This means that applications must be installed to a partition that will not be wiped if the power is lost. This can be in the form of USB storage if your router has a USB port, or a JFFS partition if you have left over space in your NVRAM when your firmware is loaded.
Before you install, you must set up your /jffs dir. This can be done by either binding a USB disk to /jffs or using the Web Interface to configure a JFFS filesystem from unused NVRAM.
To install, either telnet or ssh to your router (you may need to enable telnetd or sshd in the web interface first) and type the following command to download the install script:
wget http://dereenigne.org/wp-content/uploads/optware-install-ddwrt.sh -O - | tr -d '\r' > /tmp/optware-install.sh
Then execute the script:
Once your script has completed, you should be ready to go. To see what applications you can install, type:
ipkg-opt update ipkg-opt list | more
To install, type:
ipkg-opt install PACKAGENAME
I’ll do a more posts at a later date with guides how to configure some of the more tricky packages such as setting up a BitTorrent client and enabling SFTP access to the filesystem.