Extending DD-Wrt router functionality by installing new software using ipkg

If you have purchased a router that came pre-installed with DD-Wrt firmware, you are now officially an owner of a very capable Linux device. Chances are that you would be quite happy with the default setup. Web User Interface is pretty well organised and offers all of the basic features typically used by the non-technical crowd. For those of you that did not find everything you need in the WebUI, you will have to be courageous enough to venture into the land of CLI. Next, I will try to describe how I went about extending the functionality of my DD-Wrt based router.

All DD-Wrt v24 routers come pre-installed with ipkg package manager. It is the most primitive package manager you will ever see. Nothing compared to apt or yum, but we can make it work with some minor tweaking. Without changing anything, telnetting into the router and running ipkg update on the command line would fail with a nasty error about the "Read-only file system". That is because all of the NAND flash is not writeable by default. One option is to enable JFFS under Administration -> Management -> JFFS2 Support. Doing that is not recommended because flash memory wears out very fast in less than 100K write ops. The instructions provided below will show you the alternative approach of using the external USB flash drive for new software installations.

  • First few steps can be accomplished in the WebUI. Verify the following two settings. Setup-> Advanced Routing-> Operating Mode-> Gateway and Setup-> Basic Setup-> Connection Type-> Automatic DHCP
  • Now connect your router to the Internet. Wireless-> Wireless Mode-> Client. Type in your SSID. Click save. Fill in Wireless-> Wireless Security tab with your credentials. Click apply. Now verify that you have acquired Internet connection by looking for Status-> WAN-> IP Address.
  • Prepare a USB flash drive with a single partition formatted to EXT3. Enable USB support in WebUI under Sevices-> USB. Set the drive to auto-mount under /opt and click Apply. Now insert the USB stick into the router USB port and verify that it is mounted by refreshing Services-> USB page.
  • Next few steps are done on the command line. Telnet into the router and verify that you are ready to go by doing ping google.com, and df -h and looking for /dev/sdaX mounted under /opt.
  • Run the following command to copy files to USB drive cp -a /usr/ /opt/ & cp -a /bin/ /opt/
  • Create the default ipkg directory by doing mkdir -p /opt/jffs/tmp/ipkg
  • Mount the USB folders mount /opt/jffs /jffs & mount /opt/usr /usr & mount /opt/bin /bin
  • Ipkg update script uses wrong wget -passive-ftp option. Correct it by running cp /bin/ipkg /bin/ipkg.orig && cat /bin/ipkg.orig |sed -e "s/--passive-ftp //" > /bin/ipkg
  • Now run ipkg update && ipkg list. It should download and list all available packages from OpenWRT repositories. Do ipkg install appname to install anything you like.
  • The final step is making the mount points permanent by adding the following startup script under WebUI-> Administration-> Commands-> Save Startup.
    sleep 10
    mount /opt/jffs /jffs
    mount /opt/usr /usr
    mount /opt/bin /bin
  • While the default DD-Wrt features are reasonable enough for an average home network installation, it lacks a lot of configuration features and third party Optware applications available under the most basic flavour of OpenWRT router firmware. The default installation of DD-Wrt seemed very crippled without the ability to add/remove applications and manage running processes and services. Even after enabling ipkg, you are still stuck with the apps compiled for OpenWRT Whiterussian back in 2005-2007. OpenWRT currently offers more than twice as many apps in its latest Backfire distribution repositories.

    Back to main index