What's new

Tutorial Installing Rtorrent on AsusWrt Merlin routers through Entware

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

netware5

Very Senior Member
[TUTORIAL] Installing Rtorrent on AsusWrt Merlin routers through Entware, network storage option.

Rtorrent is alternative to Transmission as a torrent client running on routers. It is considered to be “lighter” in terms of CPU usage and RAM. The following tutorial will explain how to install it on Asus routers running Merlin’s firmware. It has been tested on my RT-N66U with 374.41 version of Merlin’s FW.

Note: Torrent applications produce extensive write activity, so it is not recommended to use them on a router without HDD attached or without network storage, as extensive write activity may damage your MicroSD card or USB stick. This tutorial is focused on more difficult option to use network storage for torrent client files and downloaded files, but it could be easily applied for locally attached HDD drive. In that case we don’t need MicroSD card or USB stick and should install Entware and Rtorrent on the HDD and use it as torrent and downloaded files storage.

*** ADDITION, thanks to ryzhov_al ***
Please note that the best solution is to use USB HDD attached. In that case you should focus on steps 3 and 5 below. Torrent clients use memory mapping which is effective only on local drives. The "network solution" is feasible only if you have no USB HDD attached to the router or your network storage itself is unable to run the torrent client.
*** ADDITION ***

Prerequisites

Merlin’s FW with jffs enabled
MicroSD card or USB stick, plugged in the router, formatted as ext2 file system and mounted
Entware installed on the MicroSD card or USB stick
Network storage (PC, NAS, etc.)

Step 1. Preparing network storage.

Create samba share to be used by Rtorrent on your network storage. We can use any existing share, but it is better to create a separate one. Create dedicated user on network storage to be used by Rtorrent and give him a password. These username and password will be used below to mount the network share. We can use any existing user, but because of security reasons it is recommended to create dedicated one. This user should have full access to the share above.

Step 2. Mount the network share.

Ssh to the router as admin

ssh admin@<router IP>

Change dir to the desired folder on the MicroSD card. We assume that it is labeled and mounted by name under /mnt. In this tutorial it is named “Data”. We will create the mount point named “Torrent_Data” there.

cd /mnt/Data

Create a mount point for the network share

mkdir Torrent_Data

Mount the network share using share name, username and password created in Step 1.

mount \\\\<IP address of the network server>\\<share name> /mnt/Data/Torrent_Data -t cifs -o "username=<username>,password=<password>"

Step 3. Installation of Rtorrent.

We are using the easy installation script included in Entware. It will do everything for you. Just answer the questions. You may just press <enter> to accept default proposals as later we will change some settings to allow using of remote share. The script installs rtorrent, rutorrent (front end of rtorrent) and lighttpd. Here you can watch a video of similar installation

opkg install rtorrent-easy-install

Step 4. Configure Rtorrent to use network share

There are 3 directories which are essential for Rtorrent: download dir, watch dir and session dir. The installation script prompts only for download dir. Other two directories are created in /opt/etc/rtorrent where the rtorrent.conf file is created also. Now we should change their location from MicroSD card/USB stick to network share.

cd /mnt/Data/Torrent_Data
mkdir watchdir
mkdir session


Stop rtorrent and lighttpd

/opt/etc/init.d/ S85rtorrent stop
/opt/etc/init.d/ S80lighttpd stop

Edit rtorrent.conf file using vi or nano editors

nano /opt/etc/rtorrent/rtorrent.conf

Edit the relevant lines as follows and save the rtorrent.conf:

session = /mnt/Data/Torrent_Data/session
schedule = watch_directory,5,5,load_start=/mnt/Data/Torrent_Data/watchdir/*.torrent
directory = /mnt/Data/Torrent_Data


Now the rtorrent will download files in network share mount under /mnt/Data/Torrent_Data and will use as session dir and watch dir Torrent_Data/session and Torrent_Data/watchdir

Start the lighttpd and rtorrent

/opt/etc/init.d/ S80lighttpd start
/opt/etc/init.d/ S85rtorrent start


Arrange the network share to be mount after reboot by adding the following lines in the user script named “services-start”, located in /jffs/scripts, BEFORE the line “/opt/etc/init.d/rc.unslung start”

mount \\\\<IP address of the network server>\\<share name> /mnt/Data/Torrent_Data -t cifs -o "username=<username>,password=<password>"
sleep 5



Note 1: If a problem occurs to mount the network share during boot process, the rtorrent will never start!

Note 2: Any changes in rtorrent.conf file should be done only while the rtorrent is stopped. You may start and stop it using the scripts in /opt/etc/init.d as described above.

Step 5. Configure firewall to open ports for rtorrent

Two ports need to be open for better performance of rtorrent - the incoming connections port and the DHT port. The rtorrent may work without opening of these ports but it will work slower and using magnet links will be not possible. In this example we use TCP port 51200 as incoming port and UDP port 51201 as DHT port. You should replace the example ports with the ports listed in rtorrent.conf file - lines "port-range" for incoming port and "dht_port" for DHT port.

Include the following lines in firewall-start user script located in /jffs/scripts:

iptables -I INPUT -p tcp --destination-port 51200 -j ACCEPT
iptables -I INPUT -p udp --destination-port 51201 -j ACCEPT


Note: If the firewall-start user script does not exist, create it.
 
Last edited:
Thank you for tutorial. IMHO, rTorrent is a best torrent client for embedded devices: light, fast, feature rich and so on.

One remark: it's not a good idea to download torrents to network share. A torrent clients uses memory mapping which is effective only on local drives.
 
Do any of these torrent gizmos running on the RTN66U make use of the rather poorly implemented Asus QOS so as to not bog down your network?

Can they run on Tomato on the Asus routers that has a much better implemented QOS?

thanks

Thank you for tutorial. IMHO, rTorrent is a best torrent client for embedded devices: light, fast, feature rich and so on.
 
Do any of these torrent gizmos running on the RTN66U make use of the rather poorly implemented Asus QOS so as to not bog down your network?

Can they run on Tomato on the Asus routers that has a much better implemented QOS?
Firmware QoS *can* control transit traffic (from LAN clients to internet) but *can't* do anything with local traffic (from router router programs to internet).

As long as torrent clients are greedy to traffic, you have to set bandwidth limit on rTorrent. I've added limits settings to rtorrent-easy-install wizard.
 
Thank you for tutorial. IMHO, rTorrent is a best torrent client for embedded devices: light, fast, feature rich and so on.

One remark: it's not a good idea to download torrents to network share. A torrent clients uses memory mapping which is effective only on local drives.

I fully agree with you. I've been forced to configure the rtorrent to use network share because I urgently needed it and have no USB HDD attached to the router. My NAS (Seagate Blackarmor) itself is not able to run torrent client also due to the FW limitation. But in any case using network share is better than using USB flash drive or MicroSD card due to the extensive writes which may damage the flash memory. So the network solution is feasible in such cases. I will edit the Tutorial to focus the attention that using HDD drive is the best solution for rtorrent on Asus routers.

Just for information, I've reached the maximum download speed (as settled in rtorrent.conf) of 2 MB/s without any problems.

BTW, thank you very much for the excellent script which facilitates the easy installation of rtorrent under Entware.
 
Last edited:
PMFJI, but why run a Torrent client on the router rather than a computer?
 
PMFJI, but why run a Torrent client on the router rather than a computer?

There are two possible reasons:

1. The computer (PC) usually is not running 24/7 while the router is.
2. If the "computer" is some type of commercial NAS running 24/7 it may be unable to run torrent client because of FW limitations or because the user has no root access to it. BTW, my Seagate Blackarmor NAS is exactly that case. I've rooted it, but I can not install Entware there without replacing the original FW.
 
Last edited:
Hi guys, can the Rtorrent be installed on Optware?, if so is there a tutorial?
Thanks
 
Hi guys, can the Rtorrent be installed on Optware?, if so is there a tutorial?
Thanks

Rtorrent is included in Optware, so the answer is YES. The installation steps should be similar to the described in the tutorial. For further information try to google it.
 
Which better entware torrent client?Transmission or rtorrent?Rtorrent have webui and windows gui program?

I have no experience with Transmission, so I couldn't make comparison. But

ryzhov_al says above that Rtorrent is the best for embedded devices.

Yes, Rtorrent has an webui.
 
i haven't yet tested rtorrent, but my n66w in ap mode with transmission downloaded a 1.5gb file maxing my 10mbit download speed and my cpu utilization was ~60% and had 40mb mem free, without swap. transmission installed via entware. transmission was the first i tried out of familiarity.
 
double post

same configuration with rtorrent, downloading the same file at the same speed resulted in 35% cpu usage with a little over 60mb mem free, no swap. a considerable improvement over transmission; nice
 
rtorrent seemed a bit more snappy but in my opinion allowing it to go over 1MB/s and the performance difference between it and transmission doesn't make using it any better. This is based on a 2MB/s Download with 10 peers. It started digging into my swap at around 1.5 MB/s..

Still is a very nice light wait torrent client. Thanks for the guide. It was worth checking out.
 
Is there any sort of conflict with trying to run this along with the ad blocking using lighthttpd as well? This post?

http://forums.smallnetbuilder.com/showthread.php?t=16060

When I followed the guide for installing rtorrent, was unable to access the website.
Rtorrent easy installation script warns you about it's working on clean lighttpd config only. Please, fix lighttpd.conf in appropriate way to make it work with ad-blocking script.
 
Hello. I tried the rtorrent-easy-install script on a RT-AC66u running merlin version 374.41. Everything seems to install fine. I accepted all the defaults except the torrent folder location. However, after starting rtorrent there does not appear to be a web gui available at http://<ipaddress of router>:<port>/rutorrent

I added the firewall rules to be sure, but it still isn't working.

Any ideas would be great. If not I can just keep using Transmission since that installed and worked right out of the box.

Is there a remote gui perhaps for rutorrent?
 
Great! Just one question.


Why some archive is used, while all rutorrent plugins are present as packages? Try:
Code:
opkg find rutorrent-plugin*

Didn't know if are updated. Now i'm trying to make a script to send mail when torrent finishing downloading with some arguments.
Thanks
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top