OpenWrt torrent download box with LuCI web interface

What about using your router running OpenWrt as torrent downloader box ? Far better than using a smartphone or laptop for this purpose.

There are many openwrt torrent clients,

  1. ctorrent, very lightweight and robust.
  2. rtorrent, advanced and high performance, with web GUI support.
  3. Transmission, high performance, with CLI, web and remote interface.

In this tutorial we’re going to use rtorrent and luci-app-rtorrent, for a easy web based torrent downloading. Rtorrent works very well with openwrt, could be automated with a configuration file, but the ncurses based interface really sucks.

I’ve found Transmission is the most advanced of them, here is how to properly configure Transmission on OpenWrt.

Ctorrent works fine for small sized download, it has less configuration options to mess around and it’s really lightweight.


Install rtorrent and luci-app-rtorrent

The router must have a USB port to store downloaded files, around 1 MB of free space required to install all necessary packages, make sure you have enough free space on the router’s flash or configure openwrt extroot.

  1. First login to the router with ssh, and make sure it can connect to the internet.
     ssh [email protected] 
     ping -c 4  # on OpenWrt 
  2. Update the software repository
     opkg update  # on OpenWrt 

    Now install necessary packages, rtorrent, wget and screen.

     opkg install rtorrent-rpc wget screen  # on OpenWrt
  3. Download the latest luci-app-rtorrent from this github page, currently it’s version 0.1.3,
    cd /tmp  # on OpenWrt
    wget --no-check-certificate
  4. Now install luci-app-rtorrent with opkg
     opkg install /tmp/luci-app-rtorrent_0.1.3_all.ipk 

    Opkg will automatically resolve missing dependencies, i.e. it will download them from repository.

The luci-app-rtorrent is written on lua, so it’s platform independent, i.e. it works on all devices running openwrt, developers github page here.


Configure rtorrent

Let’s tweak the rtorrent configuration file, which could be found on the current user’s HOME directory, which is /root for the root user.

The configuration file is .rtorrent.rc , edit it with vi or nano, I’m using this minimal configuration bellow

encoding_list = UTF-8
system.umask.set = 022
port_range = 23877-23877
port_random = no
check_hash = no
trackers.enable = 1
dht = auto
dht_port = 6881

scgi_port =
encryption = allow_incoming, try_outgoing, enable_retry

directory = /mnt/sda2/downloads/
session = /mnt/sda2/rtorrent/session/

schedule = rss_downloader,300,300,"execute=/usr/lib/lua/rss_downloader.lua"

Here I’m using the /mnt/sda2/downloads as download folder and /mnt/sda2/rtorrent/session as working directory for rtorrent, make sure you have edited them according to your system.


Enable rtorrent at startup

To run rtorrent as a daemon at every startup, create an autostart script, /etc/init.d/rtorrent with vi or nano and paste this configuration there.

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


start () {
screen -dmS rtorrent rtorrent

stop () {
killall -9 rtorrent

Now enable autostart and start rtorrent service.

chmod +x /etc/init.d/rtorrent

/etc/init.d/rtorrent enable

/etc/init.d/rtorrent start


Testing the setup

Open up your favorite browser and enter the IP of LuCI interface, generally, login as root with your password. You will notice Torrent option in the menu bar.


Upload torrent files or copy paste the magnet link to start downloading torrent. You could also change the output folder at this step.


Optimizing torrent download speed

As torrent downloading is a memory intensive process, it’s better to add some swap space and optimize few kernel parameters.

  • To add swap, create a swap file, twice the size of RAM, in my case RAM is 32 MB so swap size is 64MB
     dd if=/dev/zero of=/swap_file bs=1M count=64 
  • Make it a swap file
     mkswap /swap_file 
  • Turn on the swap
     swapon /swap_file 

The above step is done assuming you are using a extroot setup and have enough free space on the extroot drive. Swap files works as good as dedicated swap partitions.

Add few kernel parameters listed bellow to the /etc/sysctl.conf file and run sysctl -p , this will help to improve download speed.



That’s it, your very own openwrt torrent downloader box, run it 24×7, low power usage and low cost. The tutorial may be not so newbie friendly, but it’s awfully easy if you have basic understanding of command line.

If you have any suggestion or question, just leave a comment, I’ll be happy to discuss about it. Also don’t forget to share this tutorial with friends !!

10 Responses

  1. Miguipda says:

    Well interresting but following me transmission has never had any problem and more it gives remote management.

  2. yousaf says:

    I’m stuck at step 4

  3. thyron says:

    Thank you for this. 🙂 finally got it right the second time. This was the only thing that was lacking in my router’s setup. along with the samba share on the network.

  4. Campos says:

    My rtorrent no seed to private trackers, you can help?

  5. Marcin says:

    Error 404 on step 3

    • Arnab says:

      Hi, thanks for your feedback, So you can’t download the luci-app-rtorrent ? Just visit the git repo and download the leatet version, then upload it to the router and install it with opkg.

Leave a Reply

Your email address will not be published. Required fields are marked *