LEDE/OpenWRT — Setting Up Torrent Downloading

CT WiFi
LEDE/OpenWrt & IoT
Published in
3 min readAug 10, 2016

This guide will run you through the steps needed to get a BitTorrent client (rtorrent) working with your LEDE/OpenWRT device, allowing you to download and seed files through your device.

Note; if you’re using MiniUPnP, you may need to change it’s port. It runs on port 5000 by default and can prevent rtorrent from working.

Requirements

As almost all devices come with minimal storage, you will need to set up and mount a USB storage device to handle the file downloads.

SSH to your LEDE/OpenWRT device

If you are using Windows then start PuTTY and click Session on the left side, select SSH from the options, and then enter in the IP Address of your LEDE/OpenWRT box into the Host Name field.

Once you’ve done this just click on Open to start up the SSH connection.

PuTTY

If you are connecting via terminal, then just SSH to your LEDE/OpenWRT device using the following command, where 192.168.1.1 is your LEDE/OpenWRT device’s IP address.

ssh root@192.168.1.1

Install rtorrent

First things first, we need to download the packages needed. So run the following commands:

opkg updateopkg install rtorrent-rpc wget screen

Once completed, we need to install the package that handles the GUI integration with LuCI. You will need to download the latest version of the file from this github page. The latest version at the time of writing this is 0.1.5.

cd /tmpwget — no-check-certificate https://github.com/wolandmaster/luci-app-rtorrent/releases/download/latest/luci-app-rtorrent_0.1.5_all.ipk

Now we run the following to install it:

opkg install /tmp/luci-app-rtorrent_0.1.5_all.ipk

Configuration

Now we need to tweak the config files. Run the following:

vi /root/.rtorrent.rc

Then ensure that your config file looks similar to the following:

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 = 127.0.0.1:5000
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”

Change the fields as applicable, for example your directory and session may differ to the directory that you want to use to store your files.

Once you have configured it, we want to make sure that it runs on startup.

To do this we need to create an autostart script. Run the following command:

vi /etc/init.d/rtorrent

And then make sure the file matches the following:

#!/bin/sh /etc/rc.commonSTART=99
STOP=99
start () {
screen -dmS rtorrent rtorrent
}
stop () {
killall -9 rtorrent
}

Then run the following commands to enable autostart:

chmod +x /etc/init.d/rtorrent
/etc/init.d/rtorrent enable
/etc/init.d/rtorrent start

Usage

By loading your LuCI interface now and logging in, you should notice a new Torrent option in the top navigation bar.

Here you can upload torrents or paste in download links.

If you found this post helpful please let us know by clicking the ♥ below.

This blog was brought to you by Cucumber Wi-Fi. Cucumber helps you run a more efficient Wi-Fi network. Check it out here.

Cucumber Wi-Fi — control any (Wi-Fi) device from the cloud.

--

--

CT WiFi
LEDE/OpenWrt & IoT

An orchestration tool for WiFi devices — Manage your networks from a single-pane of glass.