OpenTracker
OpenTracker is a free and open source BitTorrent Tracker software that can run on minimal resources. For example, it can run on your router so that people connected to your network can share files among them without actually uploading the file anywhere.
The idea is that each mesh node (i.e a router) can act as a torrent tracker allowing users to use any tracker they prefer. Thus the network is decentralized, federated and also peer-to-peer in nature.
1. What is a Torrent?
Torrent (also known as BitTorrent) is a peer-to-peer computer protocol using which people can share files between each other. Torrent is widely used by people around the Internet because anyone can share any file to anyone and nobody could stop it from happening.
2. What is a Torrent Tracker?
A Torrent tracker is a software that helps two people to connect each other using one of the torrent clients. Some free software torrent clients include Transmission, Deluge, qBitTorrent.
Torrent protocol works on layer 3 (i.e Network layer) based on IP address. Which means if you want your device to participate in torrent network, first your device should have a IP address. On the Internet, each time our device connects to Internet, we get a new IP address from our ISP (Internet Service Providers) like BSNL, etc., We call this IP address as dynamic address since our IP address changes every time we reconnect.
This is a problem when two people want to connect to each other on the Internet. For illustrative purpose let's assume the following scenario. On day 1, user A gets 117.23.45.112 as their IP address. If user B wants to connect to user A, then user B should know the IP address of user A and vice-versa.
2.1 How do we handle this problem of discovery in Web?
The answer is, we depend on the combination of static IP addresses (fixed IP addresses that doesn't change) and the domain name (an easy to remember name given to these IP addresses which we commonly call them as Website address).
The domain name (or) the static address is advertised to everyone so that everyone could only remember only one address or name that they can connect to. Once they are connected to such central end-points they can see each other. This is like inviting everyone to the common venue so that they can meet each other.
2.2 The Story of Torrents
With torrent file sharing, it's not about the people or their identity we look for, rather everyone are interested about the files in the network. For example, if user A wants a particular file, the user is only interested with the file and doesn't mind receiving it from any user. What's more interesting about torrents is that it doesn't depend on the presence of only one user for the file.
If user C who had the file went offline and if the same file is present with some other users in the network then the multiple pieces of the same file will be downloaded from those users in the network.
The people who shares or uploads the file they have are called Seeders and this process is called seeding. Since torrent is a peer-to-peer file sharing protocol, in general users are called as Peers.
Torrent Tracker is a common venue (a static IP or domain name) where the peers and seeders discover each other through the torrent client they use.
3. Building OpenTracker along with OpenWRT
At Pondicherry Mesh, we are have compiled the OpenWRT Chaos Chalmer from source along with B.A.T.M.A.N Advanced (version 2016.2), batctl (2016) and opentracker built-in. If you use our image for your router, then you need not do anything other than flashing the router with the image.
Anyway, if you prefer to do yourself, Openwrt has a package feed for OpenTracker which can be included in openwrt feeds and compiled as a built-in application along with the openWRT image. The feed and the build instructions are available here.
Note: The overall process of setting up the environment and compiling openwrt from source code is covered separately. You may want to refer that section to know how to include OpenTracker with OpenWRT.
4. Using OpenTracker for Sharing Files
You can ssh
into your openwrt flashed router like the following.
ssh [email protected]
It will prompt for the password of root and once you have logged in successfully, you can invoke opentracker like this
opentracker
This will start opentracker with default configuration in foreground mode. If you press ctrl+c
it will stop the opentracker.
To start open tracker in background mode, use the following command
/etc/init.d/opentracker start
When started with default configuration, OpenTracker will be listening at udp port 6969.
For example, If the IP address of your router (or) the device where OpenTracker is running is 10.0.3.1, then you should include the tracker URL as the following at the time of creating the torrent file.
udp://10.0.3.1:6969
Note: If you have a DNS and domain name, you can substitute the IP address with that instead.
Instead of manually starting opentracker everytime, you can tell openwrt to autostart opentracker whenever the router is switched on. To do that, use the following command in terminal,
/etc/init.d/opentracker enable
From now on, whenever you switch off and switch on the router, opentracker will be autostarted and so the torrent tracker will always be available as your router stays up.