PCsuggest

  • Quick tip
  • SECURITY
  • NETWORKING
  • OpenWrt
  • HARDWARE

Download torrents on OpenWrt with Transmission web interface

Updated - September 4, 2019 by Arnab Satapathi

It's pretty practical to download torrents directly on a router running OpenwWrt, instead of using another device like a smartphone, laptop or a Raspberry Pi.

Well, not every cheap router can do this, but many can do. Just make sure the router have a USB port and it supports OpenWrt.

In a previous post, I wrote about the same thing, but in a different way, OpenWrt torrent downloader box with  rtorrent and LuCI based web interface.

If you're a Linux user, probably you are more familiar with the Transmission torrent client. It's also possible to run Transmission on OpenWrt routers and monitor it through the web interface.

I think the Transmission web interface is arguably better than other alternatives, and it doesn't depend on LuCI, just some HTML and javascript magic. That's it, let's get started ...

Contents

  •  1. Install transmission and other necessary packages
  • 2. Configure Transmission on OpenWrt
  • 3. Setup swap space on the router
  • 4. Testing the OpenWrt torrent downloader
  • Conclusion

 1. Install transmission and other necessary packages

Though You can install packages through LuCI interface, but it's easier to install them through command line.

After logging in to the router via SSH, update the opkg package repository and install transmission.

ssh root@192.168.1.1       # On Linux, Mac

Or use Putty if you're on Windows.

Update the repository and install the transmission-web package.

opkg update
opkg install transmission-web

The transmission-web package and it's dependencies will consume around 1.2 MB of free space, make sure you have enough free space left on the router, or setup extroot .

amazon prime logo
Try AmazonPrime for free
Enjoy free shipping and One-Day delivery, cancel any time.

2. Configure Transmission on OpenWrt

Now edit the default transmission configuration to make it usable, the OpenWrt specific configuration file is /etc/config/transmission .

Here an example configuration bellow,

vi /etc/config/transmission      # On OpenWrt
config transmission
     option enabled 1
     option config_dir '/mnt/sda1/transmission'
     option download_dir '/mnt/sda1/Downloads'
     option incomplete_dir '/mnt/sda1/incomplete'
 
     #option user 'nobody'
     option alt_speed_down 50
     option alt_speed_enabled false
     option alt_speed_time_begin 540
     option alt_speed_time_day 127
     option alt_speed_time_enabled false
     option alt_speed_time_end 1020
     option alt_speed_up 50
     option bind_address_ipv4 '0.0.0.0'
     option bind_address_ipv6 '::'
     option blocklist_enabled false
     option blocklist_url ''
     option cache_size_mb 2
     option dht_enabled true
     option download_queue_enabled true
     option download_queue_size 4
     option encryption 1
     option idle_seeding_limit 30
     option idle_seeding_limit_enabled false
     option incomplete_dir_enabled false
     option lazy_bitfield_enabled true
     option lpd_enabled false
     option message_level 1
     option peer_congestion_algorithm ''
     option peer_limit_global 240
     option peer_limit_per_torrent 60
     option peer_port 51413
     option peer_port_random_high 65535
     option peer_port_random_low 49152
     option peer_port_random_on_start false
     option peer_socket_tos 'default'
     option pex_enabled true
     option port_forwarding_enabled true
     option preallocation 1
     option prefetch_enabled true
     option queue_stalled_enabled true
     option queue_stalled_minutes 30
     option ratio_limit 2.0000
     option ratio_limit_enabled false
     option rename_partial_files true
     option rpc_authentication_required true
     option rpc_bind_address '0.0.0.0'
     option rpc_enabled true
     option rpc_password '1234'
     option rpc_port 9091
     option rpc_url '/transmission/'
     option rpc_username 'MyUserName'
     option rpc_whitelist '127.0.0.1,192.168.1.*'
     option rpc_whitelist_enabled true
     option scrape_paused_torrents_enabled true
     option script_torrent_done_enabled false
     option script_torrent_done_filename ''
     option seed_queue_enabled false
     option seed_queue_size 10
     option speed_limit_down 100
     option speed_limit_down_enabled false
     option speed_limit_up 20
     option speed_limit_up_enabled false
     option start_added_torrents true
     option trash_original_torrent_files false
     option umask 18
     option upload_slots_per_torrent 14
     option utp_enabled true
     option scrape_paused_torrents true
     option watch_dir_enabled false
     option watch_dir ''

Notes:

  1. A partition of USB drive(/dev/sda1) is mounted at /mnt/sda1 , you must change the the download_dir and incomplete_dir options to avoid running out of space. You can use any folder location, just make sure it have enough free space to download the torrrents.
  2. Edit the /etc/config/fstab file to automatically mount the /dev/sda1 partion to /mnt/sda1 after each boot.
  3. You may also want to password protect the Web/RPC controll interface, change the rpc_authentication_required option to true .
  4. Also don't forget to change the RPC interface username and password, chenge these two options, rpc_username and rpc_password .

After saving the configuration, start the transmission daemon.

/etc/init.d/transmission start

Also enable automatic startup of the transmission deamon.

/etc/init.d/transmission enable

3. Setup swap space on the router

Due to high memory usage, Transmission performs better when a little swap space is available.

In fact on routers with 32 MB of RAM, running the transmission deamon will result in utterly laggy performance, but adding as little as 4 MB of swap space will improve the scenario a lot.

You can use a dedicated swap partition on the USB drive or use a swap file, there is no significant performance difference between them.

I'm going with the swap file approach here, assuming you are using extroot and have enough free space on the extroot partition.

  1. Create a 16 MB blank file,
    dd if=/dev/zero of=swap-file bs=1M count=16
  2. Format is as swap,
    mkswap swap-file
  3. Turn on the swap space,
    swapon swap-file
  4. To mount the swap space automatically at every boot, add this line bellow to the /etc/rc.local file before the exit 0 line .
    swapon /root/swap-file

Add few kernel parameters listed bellow to the /etc/sysctl.conf file and run sysctl -p, this will result in more effective use of the swap space.

vm.vfs_cache_pressure=200
vm.min_free_kbytes=4096
vm.overcommit_memory=2
vm.overcommit_ratio=60
vm.swappiness=95

Adding swap space may not be necessary for routers with 128 MB or more RAM.

4. Testing the OpenWrt torrent downloader

Open up your favorite browser and type 192.168.1.1:9091 in the address bar, it should prompt you to enter the preconfigurd RPC username and password.

The Transmission web interface is much like it's GUI counterparts, if everything is configured properly, you can add torrent files to download or add magnet liks.

openwrt torrent transmission web interface

You can also controll the openwrt torrent downloader through Transmission GUI clients, I'm using the Qtransmission client to controll it.

openwrt torrent RPC remote controll

In Qtransmission, go through the Edit > Change Session > Connect to Remote Session and enter proper Host, Port, Username and Password to connet a remote session.

The same thing could be done with the gtk+ version of the Transmission for Linux, transmission-gtk .

Conclusion

Now, it's ready, your 24x7 running and low power consuming openwrt torrent downloader, it's cheper to make too !

My previous failed attempt to run transmission reliably was only due to 32 MB of RAM,  now it works fine. So, for a hassle free setup, you can use a wifi router under 100 dollar budget, which has plenty of RAM and a descent CPU to handle torrent download smoothly.

If you have any suggestion or question, please feel free to leave comment, sharing this tutorial on social networks is also highly appreciated.

Filed Under: networking, openwrt Tagged With: networking, openwrt, torrent

Your comments
  1. aris says

    October 13, 2016

    Hi.. how to check if swap using transmission effectifely ?
    Im running "top" but swap is not shown there...is that mean I missconfigured ?
    I do swapon -s ..it shows /dev/sda1 partition 1048572 104 -1

    Reply
    • Arnab says

      October 13, 2016

      Hi, I think you're using a dedicated swap partition, have you set the swapiness value ?

      Probably something misconfigured.

      Reply
  2. Rodrigo Gonçalves says

    August 21, 2016

    Excellent posts, congratulations.

    One suggestion for a future post is how to run a open VPN server in openwrt.

    Great job.

    Reply
    • Arnab says

      August 22, 2016

      Thanks Rodrigo for the suggestion, I'll definite write that.

      Reply
    • kelxon says

      August 26, 2016

      I follow this instruction and was able to get OpenVPN setup and running well on my router, it's just a little lengthy due to all the info it gives you. I can even vpn from my Android phone as well. 🙂

      https://wiki.openwrt.org/doc/howto/openvpn-streamlined-server-setup

      Reply
      • Arnab says

        August 28, 2016

        Yeah, It's a bit lengthy.

        Reply
      • Rodrigo Gonçalves says

        August 29, 2016

        I was also able to set up based on this wiki.

        It works fine for Android, but I'm facing issues with Windows and iOS clients.
        Not sure what is wrong on my set up.

        Reply

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © PCsuggest.com · All rights reserved.

  • Home
  • About
  • Contact
  • Privacy Policy
  • Sitemap