1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

[TUTORIAL] Installing Rtorrent on AsusWrt Merlin routers through Entware

Discussion in 'Asuswrt-Merlin' started by netware5, May 4, 2014.

  1. netware5

    netware5 Senior Member

    Joined:
    Mar 9, 2013
    Messages:
    331
    Location:
    Bulgaria
    [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 [email protected]<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: May 5, 2014
  2. Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!
  3. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    646
    Location:
    Russia
    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.
     
  4. mromero

    mromero Regular Contributor

    Joined:
    Nov 25, 2012
    Messages:
    160
    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

     
  5. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    646
    Location:
    Russia
    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.
     
  6. netware5

    netware5 Senior Member

    Joined:
    Mar 9, 2013
    Messages:
    331
    Location:
    Bulgaria
    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: May 5, 2014
  7. DrTeeth

    DrTeeth Senior Member

    Joined:
    Mar 29, 2013
    Messages:
    380
    PMFJI, but why run a Torrent client on the router rather than a computer?
     
  8. netware5

    netware5 Senior Member

    Joined:
    Mar 9, 2013
    Messages:
    331
    Location:
    Bulgaria
    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: May 5, 2014
  9. shooter40sw

    shooter40sw Senior Member

    Joined:
    Mar 3, 2013
    Messages:
    307
    Hi guys, can the Rtorrent be installed on Optware?, if so is there a tutorial?
    Thanks
     
  10. netware5

    netware5 Senior Member

    Joined:
    Mar 9, 2013
    Messages:
    331
    Location:
    Bulgaria
    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.
     
  11. kiesa1231

    kiesa1231 Regular Contributor

    Joined:
    Jul 13, 2013
    Messages:
    91
    Which better entware torrent client?Transmission or rtorrent?Rtorrent have webui and windows gui program?
     
  12. netware5

    netware5 Senior Member

    Joined:
    Mar 9, 2013
    Messages:
    331
    Location:
    Bulgaria
    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.
     
  13. sinshiva

    sinshiva Very Senior Member

    Joined:
    Nov 8, 2013
    Messages:
    1,030
    Location:
    FL
    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.
     
  14. sinshiva

    sinshiva Very Senior Member

    Joined:
    Nov 8, 2013
    Messages:
    1,030
    Location:
    FL
    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
     
  15. NeutralGold

    NeutralGold Regular Contributor

    Joined:
    May 2, 2012
    Messages:
    123
    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.
     
  16. prp2

    prp2 New Around Here

    Joined:
    Mar 12, 2014
    Messages:
    8
  17. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    646
    Location:
    Russia
    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.
     
  18. lokiz

    lokiz New Around Here

    Joined:
    Oct 4, 2014
    Messages:
    1
    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?
     
  19. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    961
    Location:
    Europe
  20. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    646
    Location:
    Russia
    Great! Just one question.


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

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    961
    Location:
    Europe
    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
     
Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!