31 October 2011

Building a corporate Torrent tracker server and clients

Private torrent and trackers are a great way to deal with transferring files over WAN links.  in http://fixmyitsystem.com/2011/10/using-private-torrent-to-transfer-large.html I covered the basics of configuring uTorrent as a private tracker.  In this article I will go through building a dedicated corporate torrent server. I will also cover how to configure client for remote administration and use.  It is a little strange referring to torrents in a client / server  manner but in this case this is the desired relationship.

The base server
I am building this server on Windows Server 2008 R2 Standard.
I Install the Web server role.
I Add the following additional role services over and above the default ones.
HTTP Redirection

The reason for installing IIS is that this will be the primary method for distributing the actual .tor torrent files.

Create four folders
  • C:\Active Downloads
  • C:\Completed downloads
  • C:\Torrent Seeds
  • C:\Torrent Files


Grant full NTFS access permissions on these folder to the service account that will be used for torrents.

Part 1 Install and configure uTorrent as a tracker
If you are going to be using this as a always on server i suggest you follow the guide on how to install uTorrent as a service.

Key to how this works is the uTorrent client and server components.  You will need to download the uTorrent client from http://www.utorrent.com/downloads/complete I would also suggest getting the web interface components from http://www.utorrent.com/help/guides/webui

Make sure you are logged in as the service accoutn when cofiguring the following.
The basic config is covered in http://fixmyitsystem.com/2011/10/using-private-torrent-to-transfer-large.html

A few setting you will need to double check when following this guide is
  • During installation make sure "Start uTorrent when Windows starts up" is NOT checked
  • Port Used for Incoming connections is fixed on 443
Once the installation is completed change the default directories.

  • Open the uTorrent Client
  • Select Options - Preferences
  • Directories
  • Check Put new downloads in... C:\Active Downloads
  • Check Move completed downloads... C:\Completed Downloads

Part 2  Installing the Web UI
The web UI is a great way to remotely control and manage both the torrent "server" and clients.  This process should be followed on all the client machines where you will be installing uTorrent as well.

  • Open the uTorrent Client
  • Select Options - Preferences
  • Advanced
  • Web UI
  • Enable Web UI




There are some other options here worth noting  Since we are already fixing the connection port we do not have to specify an alternative.  For the client however you might want to consider setting this.

We now have to deploy the downloaded WebUI files for the uTorrent client to use.
Rename the downloaded file to webui.zip
Copy the file to %appdata%\utorrent  normally C:\Users\username\AppData\Roaming\uTorrent

You should now be able to connect to the web UI by connecting to http://localhost:443/gui or http://servername.domain:443/gui

Part 3 Configure IIS
IIS allows us to make the torrent files available by a URL.  The web client can be instructed to obtain a torrent via a URL so this is an ideal scenario.

I add an additional IP address to the server and bind that IP to the default web site.

  • Open IIS Manager
  • Select the Default Site
  • Click Binding from the Right Hand Actions Pane
  • Change the IP address from "all unassigned" to the secondary IP

Change the physical path of the site

  • Click Basic setting from the actions pane
  • Change physical path to C:\Torrent Files

Enable Directory browsing

  • Double Click Directory browsing and Enable it from the actions pane

Allow the .torrent MIME type

  • Double Click MIME types
  • Click Add from the action pane
  • File name extention = .torrent
  • MIME type = application/torrent

.
Part 4 Getting it all to work together
The point of this is to get a solution working where you can centrally manage and distribute files.  For this you have the torrent tracker hosted centrally, and you are using the web UI on the remote machines to control what they download and also how much resource they can consume etc.

On the local central torrent server

  • Create torrent file or folder in C:\Torrent Seeds
  • Save .torrent file to C:\Torrent Files
  • The torrent should start seeding
  • Open browse to http://secondaryip/
  • The created torrent file should be listed - copy this link





To download this torrent remotely

  • Connect to web UI of the "client machine"
  • Log In
  • Click the add torrent from URL Icon
  • Add the torrent URL file from the URL link copied above

The torrent should now start downloading.


Conclusion
Following this guide you can build infrastructure that allows a single person to publish and distribute files over slow unreliable links.  The fact that both the torrent server and remote client can be managed remotely adds a huge advantage in case one needs to "jump in" and stop a constrain a torrent from seeding or downloading.
Since standard ports are used through the process it also simplifies firewall and Access Control Lists and NATs etc.



More on using torrents
http://fixmyitsystem.com/2011/10/building-corporate-torrent-tracker.html
http://fixmyitsystem.com/2011/10/using-private-torrent-to-transfer-large.html
http://fixmyitsystem.com/2011/11/run-any-executable-as-service.html





No comments:

Post a Comment