WZR-HP-G300NH Modding Guide

I recently upgraded to a Buffalo WZR-HP-G300NH home broadband router after my Linksys WRT54GL router running on DD-WRT died on me. I was looking for a router that could support the custom DD-WRT firmware, USB storage, BitTorrent downloads, Optware and with Wireless-N capability. The Buffalo WZR-HP-G300NH simply met all my requirements!

This article will guide you on how to install a vanilla version of DD-WRT on the router together with the Transmission BitTorrent client running on top of Optware.

Install DD-WRT

Buffalo ships the current models of the WZR-HP-G300NH routers with DD-WRT firmware, but features like SSH are disabled. I was also unable to install additional packages using Optware, therefore I decided to mod the router with a vanilla version of DD-WRT.

For the normal DD-WRT releases, goto DD-WRT Router Database and enter WZR-HP-G300NH in the search box. Download the image which is used for the initial flashing.

dd-wrt router database

For the latest DD-WRT releases, go here and navigate to “Downloads -> others -> eko -> BrainSlayer-V24-preSP2” and navigate further into the latest DD-WRT firmware build directory and download the latest available firmware images.

dd-wrt other downloads

Flash the router using the router’s web interface once you have downloaded the firmware. I am using the latest DD-WRT firmware that was released on the 24-Dec-2010. Remember to change the password and configure the router as necessary. I will not go into details on the basic configuration for the router as the DD-WRT wiki site has all the necessary details.

Prepare USB Disk

To use the USB disk with the router, at least one of the partitions has to be formatted as ext2 or ext3. I recommend to use the ext3 partition. If you do not have a Linux machine to do the partitioning, do not panic. You can use the MiniTool Partition Wizard Home Edition to modify the partitions of the USB disk within Windows. Create a primary partition and format it as ext3.

Before plugging in the USB disk to the router, enable the USB support in the router. Under DD-WRT web gui, navigate to “Services -> USB” and turn on all the features and set the mount point to be “/mnt”.

dd-wrt usb support

To transfer files between the USB disk and to my PC, I use FTP. Enable FTP in the router by navigating to “Services -> NAS”. You can specify username-password combinations for the FTP login if necessary.

dd-wrt nas ftp

Connect the USB disk to the router once you are done.

Directory and mount-point structure

I am using the following directory structure:

  • /mnt: mount point for the USB disk
  • /mnt/d01/torrent: directory used to hold the torrent configuration as well as the torrent downloads
  • /mnt/opt_xx eg. /mnt/opt_01, /mnt/opt_02: different optware installation directories for different possible optware builds
  • /opt: this directory will be mounted with a loopback device by pointing to one of the optware directories (eg. /mnt/opt_xx). this will give the flexibility to test different optware packages just by mounting a different source directory.

Configure Optware and Transmission

The default Optware packages for DD-WRT are built for the mipsel architecture. The Buffalo WZR-HP-G300NH is using Atheros chipset which is based on mips architecture. I got the optware packages for this router from OpenWrt site. Do note that the optware packages will be accessible via a chroot’ed environment.

To proceed further, you will need a SSH client. I am using the free PuTTY SSH client. SSH to the router and run the following commands.

You should now be in a chroot’ed optware environment. Continue installing the optware packages.

Now, modify the configuration file, /etc/config/transmission (in the chroot’ed environment), which is used for the Transmission BitTorrent client. The contents of my configuration file can be found below. Take note of the directory related options.

Exit out of the chroot’ed enviroment and unmount the USB disk.

Enable Autostart of Transmission BitTorrent Client

To automatically start the Transmission client during the router’s startup, we will need to make use of DD-WRT’s startup scripts.

The scripts will auto-mount the USB disk on startup and will also start the torrent client. Once the USB disk is mounted, the scripts will also enable the blue LED at the back of the router. When the disk is unmounted, the blue LED will be turned off.

The scripts will also configure the AOSS switch on the router as a toggle switch. Upon every press of the switch, the scripts will automatically either mount or unmount the USB disk. In this way, you may press the AOSS button to shutdown the torrent client and also to unmount the USB disk before you poweroff the router.

From DD-WRT web interface, navigate to “Administration -> Commands”.

Copy the following code and save it to the ‘Custom Script section:

Copy the following code and save it to the Startup section:

Copy the following code and save it to the Shutdown section:

Finally, we will need to open the firewall ports for the torrent client to work. Copy the following code and save it to the Firewall section:

Save the changes and reboot the router for the changes to take effect.

The web interface for the Transmission BitTorrent client can be accessed on port 9091. If your router’s IP address is 192.168.1.1, try opening the URL http://192.168.1.1:9091/ from your browser.

Final Notes

  1. To access the chroot’ed Optware environment, run the following chroot command within a SSH session:
  2. The block device that I am using in the script to point to the USB disk is /dev/sda1. In older DD-WRT firmwares, it used to be /dev/scsi/host0/bus0/target0/lun0/part1.
  3. You may want to perform a manual filesystem check on the USB disk once a while to check for a possible filesystem corruption, if any.
  4. Buffalo has an alternate DD-WRT (Professional) firmware version for this router, but this firmware does not seem to work on Asian models of the same router model.
  5. The latest Optware packages from OpenWrt can be downloaded from http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/. But the torrent downloads were frequently getting corrupted with the latest snapshots, therefore I opted for an older build of Optware.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }