User Guides Step by Step guide to setting up Buffalo router into a torrent downloader & NAS box

I have been using the Linksys 610N as a torrent downloader plus wireless router for the past year and while I was happy with the router, there are a few things that were bugging me. One was the NAS speeds to copy the downloaded torrents to my PC. I would hardly get 3mbps. I have also tried the Asus W500g and that was also a broadcom chipset and it was more limited than the Linksys.

So I decided that I would give a try for the Atheros wireless chipset. I shortlisted and got the Buffalo WZR-HP-G300NH router for INR 5k. It is a sleek black router with nice antenna's, fantastic wireless range, gigabit ports, a 400MHz processor, 32MB flash, 64MB RAM and a USB port.

The biggest stumbling block with the Atheros chipset was the fact that DD-WRT had limited support for packages on this chipset. The reason being that the Atheros CPU in the Buffalo router is MIPS while the Broadcom routers like Linksys 610N are MIPSEL. In laymans terms, it means the popular optware packages in DD-WRT compiled for broadcom will not work on this router. I installed dd-wrt and the openwrt packages using a lot of hacks documented on the web and most things did work. Then I started discovering issues, the primary one being there is no large file support in the firmware, so any downloaded files over 2gb would not even be visible on the Samba share.

This left me with the last option, install OpenWRT on the router. Information on OpenWRT is sadly less than for DD-WRT, there are lots of scattered information all over the net, but no consolidated place. Anyways, once I finished the setup, I was pleasantly surprised by the performance of NAS and the wireless ! I easily get over 7mbps to read files off the NAS connected to the WZR-HP-G300NH and the wireless range is fantastic. It also seems to draw less power than the Linksys (3watts as compared to 7watts for the Linksys).

Since I struggled for over a week to get everything working, I decided to document the procedure. Here are the exact steps to setup and configure the Buffalo WZR-HP-G300NH with OpenWRT to act as a wireless router, NAS and torrent downloader.
Remember a few ground rules.

1. Rule one, make sure that all the features of the router works in its default firmware before you move further. If there is a issue with the hardware, you do not want to find out after you have voided the warranty.

2. On the warranty front, OpenWRT is not a supported firmware for the Buffalo, so you might need to move back to the official firmware if there is ever a need to open a warrarty request. Do not blame me if you end up messing everything and cannot revert for some reason.

3. The router is virtually un-brickable as it has TFTP support in its bios. So you can almost always recover in any worse case scenario. Just make sure you have a Linux machine or LiveCD that can be used to update the firmware with TFTP.

4. Have a UPS connected to the router when upgrading. Power cut halfway through a upgrade is one way to void point 3. This router takes almost 5 minutes for a flash update and goes through multiple boots. Never do anything with the router till the red diagnostic LED stops flashing and the green LED come on solid. Get some popcorn if you do not have patience !!!

5. Make sure you have the Indian (B0 C0) or a non Japanese version of the router. This 4 digit code is printed on the router itself above the default SSID (unfortunately no way to figure this out unless you open the box. But if you are buying from a dealer in India, you will not get the Japanese version). If you have a Japanese version (A0 A1 or A0 A3), STOP right now and read this link , there are lots of complications with the Japanese router upgrade.
Here goes:
1. Download the latest "buffalo_to_ddwrt_webflash-MULTI.bin"

Pick on the latest date in the ftp link, move to the buffalo_wzr-hp-g300nh folder to get your file.

ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/

I particularly used the file from this link for my work.

Note : There is a easier way to directly move to OpenWRT using the TFTP method as described in the last section, but I will use the easy method, even if it means three firmware flashes !!!


2. Connect to 192.168.11.1 with your browser and go to the firmware update page.


Choose the file you downloaded in step 1 and wait till the router is flashed fully.

Note : I will be referencing 192.168.11.1 as the default router page. Sometime the default page could be 192.168.1.1. One of them will always work.
3. After the reboot, if you again go to the router homepage via your browser, you should now see the DD-WRT webpage.

Change the admin password so that you can use ssh and login using the same password you just set.
4. Login to the router via ssh (Can use putty.exe)

Run these commands :

cd /tmp
wget http://downloads.openwrt.org/backfi...wrt-ar71xx-wzr-hp-g300nh-jffs2-sysupgrade.bin
mtd -r write openwrt-ar71xx-wzr-hp-g300nh-jffs2-sysupgrade.bin linux

Note : As of now, 10.03.1-rc4 is the latest, always go for the latest version you find.

Wait for a full 6-9 minutes before you do anything. When the router comes up again, you should have OpenWRT running.
5. Run the following commands one by one to install all the USB and file system drives :

opkg update
Make sure this command above completes. If there is a issue with your network, the update will fail. Fix this before you move ahead.


opkg install kmod-fs-btrfs kmod-fs-ext2 kmod-fs-ext3 kmod-fs-ext4 kmod-fs-isofs kmod-fs-reiserfs kmod-fs-vfat kmod-fs-xfs

opkg install kmod-nls-cp1250 kmod-nls-cp1251 kmod-nls-cp437 kmod-nls-cp775 kmod-nls-cp850 kmod-nls-cp852 kmod-nls-cp866 kmod-nls-iso8859-1 kmod-nls-iso8859-13 kmod-nls-iso8859-15 kmod-nls-iso8859-2 kmod-nls-koi8r kmod-nls-utf8

opkg install kmod-usb2 kmod-usb-storage kmod-usb-storage-extras block-hotplug block-mount hotplug2

6. Connect a USB drive to the router and reboot.


Im going to assume that there is a external drive connected with a single partition formatted to ext3. If you need more partitions or a different file system, you probably know what you are doing, so tweak the commands !!!
7. The next set of commands are a safety net.

If you ever bootup without the USB drive connected, you might end up writing to the router flash and mess things, so the command below will make sure you cannot write anything to the share if the drive is not mounted.

mkdir /mnt/download -p
touch /mnt/download/WARNING_USB_DRIVE_IS_NOT_MOUNTED
chmod 444 /mnt/download -R
8. Run the following commands to setup the first partition to be mounted automatically :

uci set fstab.@mount[0].target=/mnt/download
uci set fstab.@mount[0].device=/dev/sda1
uci set fstab.@mount[0].fstype=auto
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].options=rw,sync,noatime,nodiratime
uci commit fstab

Reboot the router
9. Run the following commands to install samba3:

cd /mnt
chmod 777 download/
cd download/
mkdir -p /mnt/download/downloads
mkdir -p /mnt/download/torrents
chmod 777 downloads torrents

opkg update
opkg install samba3 luci-app-samba

uci set samba.@samba[0].name=Buffalo
uci set samba.@samba[0].description=Buffalo
uci set samba.@samba[0].workgroup=WORKGROUP
uci set samba.@sambashare[0]=sambashare
uci set samba.@sambashare[0].guest_ok=yes
uci set samba.@sambashare[0].path=/mnt/download/downloads
uci set samba.@sambashare[0].name=download

uci commit samba
10. Samba3 is now installed. Time to configure it.

Edit the file : /etc/samba/smb.conf.template

Add the lines :
force user = root
writeable = Yes
create mask = 0777
directory mask = 0777
inherit permissions = Yes​

Remove the line:
invalid users = root​
11. Run the command to start samba :

/etc/init.d/samba restart

At this point, use explorer to goto \\192.168.11.1 to make sure the samba share is accessible and writable.
12. Time to install transmission for the torrent downloads.

Run the following commands :

opkg install transmission-web
transmission-daemon -g /mnt/download/torrents
killall transmission-daemon
cd /mnt/download/torrents
cp settings.json settings.json.copy
13. Time to configure transmission startup :

Replace the contents of the file /etc/init.d/transmission with the text below :

#!/bin/sh /etc/rc.common

START=99

start(){
cp /mnt/download/torrents/settings.json.copy /mnt/download/torrents/settings.json
transmission-daemon -g /mnt/download/torrents
}

stop(){
killall transmission-daemon
}
14. Edit the file /mnt/download/torrents/settings.json.copy and replace all the content in the file with these lines below :
{
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 2,
"dht-enabled": true,
"download-dir": "/mnt/download/downloads",
"encryption": 1,
"incomplete-dir": "/mnt/download/incomplete-torrents",
"incomplete-dir-enabled": false,
"lazy-bitfield-enabled": true,
"lpd-enabled": false,
"message-level": 2,
"open-file-limit": 32,
"peer-limit-global": 240,
"peer-limit-per-torrent": 60,
"peer-port": 55555,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": 0,
"pex-enabled": true,
"port-forwarding-enabled": true,
"preallocation": 1,
"ratio-limit": 2,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": false,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "{414db619f34798e4204bce201b584670afd2795ax7vJCOc.",
"rpc-port": 9091,
"rpc-username": "",
"rpc-whitelist": "*",
"rpc-whitelist-enabled": true,
"speed-limit-down": 1000,
"speed-limit-down-enabled": true,
"speed-limit-up": 100,
"speed-limit-up-enabled": true,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 0,
"upload-slots-per-torrent": 14
}

If you know what you are doing, feel free to change any of the values above to change the behavior of your torrent downloader.
15. Run the command below to make transmission auto start with the router :

cd /etc/init.d; chmod +x transmission; ./transmission enable
16. Reboot the router and browse to : http://192.168.11.1:9091

You should see the transmission webpage from where you can add and control all torrent downloads.

:clap:
That is about it. Add torrents, let the router download all night, then use samba to copy the downloaded file to your machine !!!

Have fun downloading and NAS'ing

:clap:


If you mess up with the steps and your router stops responding : :
:mad:

1. Boot into linux on the PC (LiveCD will work well), typically Ubuntu 10.10. Connect the PC network cable to the lan port closest to the blue WAN port. Switch OFF the router.


2. Run the following commands (substitute the XX:XX with your router's MAC ID which is printed on the box):

ifconfig eth0 192.168.11.2 netmask 255.255.255.0
arp -s 192.168.11.1 xx:xx:xx:xx:xx:xx

3. Now run the tftp command and enter the commands under it one by one,
tftp 192.168.11.1
binary
rexmt 1
timeout 60
trace
put openwrt-ar71xx-wzr-hp-g300nh-jffs2-tftp.bin

4. Now turn on the power to the router even as the command above is running.
The TFTP command would timeout a few times and will start the process as soon as the router is turned on. Wait for a full 10 minutes after the tftp command returns (yes, it takes that long !) and you should be back up and running.
 
Re: Step by Step guide to setting up Buffalo router into a torrent downloader & NAS b

You can buy the same router I described and run it as it ships from the factory to download torrents. Just that it will not have the extended functionality of a torrent client, but it works well for simple torrent downloads. Id you ever get the kick to try something, you can always experiment as explained in the post !!!

Current ebay price is 4.5k. Possibly lower price if you buy locally.
 
Re: Step by Step guide to setting up Buffalo router into a torrent downloader & NAS b

thanks vinayaga...i shall definitly try this///
 
Re: Step by Step guide to setting up Buffalo router into a torrent downloader & NAS b

Hi Vinay

After completing step 5, I was lookig for the settings on my router. I think I enabled/disabled DHCP. After that I am not able to get proper IP address for the router. How could I connect to the router or reset it ?
After connecting, I get the following

Status : Limited or no connectivity
IP Address : 169.254.213.77
Subnet Mask : 255.255.0.0
Default Gateway : Blank
 
Thank You, Very Useful

I just used the setup for Transmission and works perfectly on Asus WL500g (Topex Byton GPRS) with OpenWRT.
 
You are welcome. Also checkout my new thread on adding a media streamer to the router :)

Thanks for a guide, need it for my asus router.


---------- Post added at 08:29 AM ---------- Previous post was at 08:27 AM ----------

Has to be the Asus 520GU with Tomato firmware installed. It is the only sub Rs 1700 router that is rock solid and yet has lot of possibilities to hack with the usb port.

Can anyone suggest me a best wifi router in the range of Rs.1500. please.
 
Back
Top