I followed this install guide when installing Transmission. It helped enormously!
**************************************************************************
Install Transmission on Gargoyle Routers for Noobs
Gargoyle is an easy GUI based configuration tool for routers. It runs on top of OpenWRT an open source router firm ware using basic text command line for configurations. Transmission must be installed using the routers OpenWRT command line system. Gargoyle does not currently (at v1.8) have Transmission or other torrent clients as easy to install GUI plugins. (A shame…..)
My TP Link Router TL-WR1043ND v2.x is using the Qualcomm Atheros QCA9558 CPU at 720 MHz with 64MB DDR Ram. This is quite fast for a router but limited as far as file transfer and Transmission goes. However, Transmission works well on this setup. I have tested it with over 20 files seeding and 4 downloading all at once. Many are large 20G+ files as well. The Transmission GUI (v5.01) works well and is very similar to uTorrent. You only need to use the command line to setup Transmission but not to operate it once its been setup.
The router USB hard disk must be formatted with EXT4. NTFS works (Even 4TB), but is 25% the speed with heaps of extra CPU overheads for the router. I am not joking when I say this! EXT4 is 4-5 times the speed, especially on file transfer across the network to the PC. Expect about 10mb when router is mostly idle and 3mb when router is under Transmission full load. We also need EXT4 to setup a SWAP partition of around double memory size. This is important for UNIX memory management when running Transmission.
Format the drive in Gargoyle itself to make sure it is setup right. The swap partition need only be about 512mb in size. (At least double RAM size.) We talk more later on setting the router to use this swap partition. For now lets start the Transmission install.
So here goes. In Gargoyle under “system” select “plugins”. Go to bottom and do “refresh plugins”. Now install the “services manager” and “webshell” plugins. We can use the webshell to enter text commands, however, I found that SSH was better. Under “access router” enable SSH and download a SSH client. “Putty” was simple and good.
Open Putty and enter the router IP address and click save and then open. 192.168.1.1
Login as
root Password is what you use for router web login.
Need to install transmission daemon. The daemon runs in the background and is designed to not have any form of visual interface. I'm using version 2.84 (14307) at present.
opkg update
opkg install transmission-daemon
Need to control the transmission daemon. Can use the more limited web interface system or Transmission JSON-RPC (Remote Procedure Call) system. RPC is better since we can run a GUI on a remote host machine with functionality similar to uTorrent. I used “Transmission Remote GUI”. So install RPC:
opkg install transmission-remote
Assuming successful installs above it is time to enable Transmission in the router. We can't connect to it using our RPC front end GUI until it is enabled in its configuration file. We will also setup other Transmissions settings here.
cd ..
ls
cd /etc/config
vi transmission
Now you are editing the transmission settings file. Press the
ins key and change:
option enabled 1
Plug the Torrent drive into the USB port on the router. In Gargoyle go to the webshell and type:
mount
We are looking for the mount name for the drive to use for torrent downloading. It might look something like this.
/tmp/usb_mount/499deee3-a38a-4384-b4f5-f32aa4aa6f91
Change the config file to look like so:
option config_dir '/tmp/usb_mount/499deee3-a38a-4384-b4f5-f32aa4aa6f91/transmission'
You need to set the download directory and the incomplete directories as well. If you want to access transmission remotely from the web. RPC White listing allows only computes at certain ip addresses to connect. It blocks all others hence the * added below:
option rpc_whitelist '127.0.0.1,192.168.*.*,*.*.*'
You will want to add a user name and password to the Remote section of Transmission to block any unauthorized access:
option rpc_username 'your username'
option rpc_password 'your password'
We should also cover our tracks relative to error reporting. These can be read with
logread if we change:
option message_level 2
When done press ESC and now type ZZ to exit and save the config file. Close the SSH session window. In Gargoyle select “services” and tick transmission to start and auto start. Save the settings.
We can now connect using our RPC GUI program.
Create a connection. Use 192.168.1.1 (unless you changed it) and leave other options alone. Port 9091 is default and should work fine.
You need to stop and restart the Transmission service after editing and saving its config file with vi to get the changes to take effect.
All Torrents work better with their ports opened. Open port 51413 for the Transmission daemon to have incoming access from the WAN. Back to SSH and Putty.
vi /etc/config/firewall
Now add the following rule:
config rule
option target 'ACCEPT'
option src 'wan'
option proto 'tcpudp'
option dest_port '51413'
option name 'transmission-daemon'
If you want to control Transmission from any computer connected to the internet then also open port 9091.
config rule
option target 'ACCEPT'
option src 'wan'
option proto 'tcpudp'
option dest_port '9091'
option name 'transmission-daemon 9091'
Restart the firewall to activate the new settings.
/etc/init.d/firewall restart
Transmission GUI port test still indicates a closed port but the following web page indicates it is open. The client acts as if its open and I think the port test is a bug in v5.01 of the GUI client. May take some time after Transmission is started for the ports to indicate open on this web page.
http://www.yougetsignal.com/tools/open-ports/
If the port never opens on this web page also check the WAN IP under status in Gargoyle. You should not run double NAT and this IP listed should be your internet IP address. If its the address of your ADSL modem for example (10.0.0.1) then you are running double NAT and your ADSL modem is properly blocking the port. Either open the port in the ADSL modem or set it to use DMZ on its LAN connection to the WAN on the TP-Link.
Remote web access includes Android phones. Install the free Tornado app or Transdrone from Google Play. Use your internet IP address and port 9091 opened above. You will also need to enter the RPC user name and password you specified earlier.
Last setup part relates to Transmission memory usage. When you add larger torrents and they start to download you may find that the Router keeps stopping and restarting or locking up.
It has properly run out of memory! While free shows resources it isn't real accurate. Transmission will take most available resources when downloading large files. Make sure your EXT 4 formatted drive has a working swap partition. You should see the swap partition listed under Status/Overview in Gargoyle if its actually working and enabled or listed with more than 0 beside it with
free.
If not, enable the swap partition in Putty:
vi /etc/config/fstab
Make sure there is a 1 beside enabled:
config 'swap'
option 'device' '/dev/sda2'
option 'enabled' '1'
Troubleshooting:
If something can go wrong it usually does at some point... Changing drives and even reformatting the same USB router drive results in a different drive ID. This means transmission will have to be setup again to work with the drive. This also means re-adding all the torrents and re-verifying them which is very slow for large torrents. (Hours…...)
The transmission/torrents folder contains the torrents. Move these out and rename them to get rid of the numbers off the end. You then need to double click each one which will add it back into the Transmission daemon. Transmission GUI needs to be setup as the default handler of torrent files for this to work. In the GUI under Application Settings/Advanced/Integration tick the two boxes.
Don't just rename these torrent files and put them back in the torrents folder. For some reason they will start and verify every time the daemon is started. A bug?
The resume folder contains the exact info relative to each torrent. Just delete the resume files. The torrents will not start to re-verify and download where they were left off unless these files are gone. The old resume files appear locked to the old hdd drive id and don't transfer over to the new drive. I tried….
Also there are some other issues if the Transmission daemon stops during the verifying stage. The files already verified will restart to seed or download where they left off but the ones in the queue will be stopped. This is open bug #4545. Don't click them to start. This will re-download and not re-verify. Manually click on verify instead. We don't want to re-download what we already have!
logread can help with other errors reported during boot. I actually solved one memory error in the log file by adding the following:
vi /etc/sysctl.conf
net.core.rmem_max=4194304
net.core.wmem_max=1048576
Hope this helps a few people. It really helped me. Nice to have all the needed information in one place! Enjoy Transmission!