tech·an·ic \te-ˈka-nik\ n. Thoughts on technology from Josh Dick.

Unblocking BitTorrent

How to make BitTorrent work despite your ISP's best efforts.

Beware! This article was originally written in 2008 and contains outdated information. For example, Azureus has long since been renamed to Vuze, and the information in the article regarding specific configuration dialogs in Azureus/Vuze and μTorrent is out of date.

Another important type of BitTorrent-unblocking tool that has become popular since this article was written is VPN services, which require no proxies like the article discusses. However, the proxy methods are still valid as of this writing.

Even though it's outdated, this article still contains useful information and the basic concepts haven't changed, so it will remain online for now.

Enjoy,

Josh

January 4, 2011

I'll begin with the usual disclaimer: I'm not responsible for anything that might happen to you as a result of trying the things described in this article. If you're reading this, you're probably aware of the legal issues surrounding BitTorrent (or specifically, what people download with BitTorrent,) and what you do with BitTorrent is your responsibility. Use your best judgment and don't anger your network administrators or Internet service provider.

Okay, now that the lecturing is out of the way...

...You're reading this because you want to know how to 'unblock' BitTorrent. Maybe your Internet service provider (ISP) or network administrators block BitTorrent traffic on their network(s). Maybe you can't download a .torrent file from a tracker web site, or maybe tracker web sites are just plain blocked. Fear not...usually, there's a way around all of this. Because the methods and procedures outlined in this article follow a catch-all approach, they will work in most cases. However, I can't guarantee that they'll work with your Internet connection or on your particular computer/software setup. Conversely, it's also possible that you might not have to do all of the things described below to get BitTorrent working. Experiment! This article assumes you have a basic knowledge of BitTorrent (what a tracker is, what peers and seeds are--that kind of thing.)

Enough background information. Let's get our hands dirty, already.

Section 1: Unblocking Tracker Web Sites/Getting .torrent Files

This section deals with acquiring .torrent files from BitTorrent tracker web sites such as ISOHunt or Mininova. If you can download .torrent files but can't download actual content, proceed to Section 2 of this article.

  • If you can access a tracker web site but are unable to download .torrent files from it:

    • Upload this PHP script to a remote web server and navigate to it with a web browser. Paste a link to a .torrent file into it, and the script will act as a makeshift proxy, allowing you to download the file. I found the script on the Internet and modified it slightly.
  • If the tracker web site is blocked entirely, you'll have to use one of three different unblocking approaches to get access:

    1. Web Proxies

      One of the easiest approaches is to use a web proxy. You can either use a public web proxy, such as one of the Privax Network proxies, or you can use your own by installing a proxy script on a remote web server. My own PHP script PageForward and James Marshall's CGI script CGIProxy are two excellent web proxy scripts that you can install and run on a web server. If you are able to unblock tracker web sites using this method but are still unable to download .torrent files, you can try downloading them by using the PHP script mentioned above.

    2. Public SOCKS/HTTP Proxies

      Modern web browsers can be configured to tunnel their traffic through a SOCKS or HTTP proxy. Configure your browser to use any proxy that you have access to, and then attempt to use a BitTorrent tracker site the same way you normally would. If the proxy setup is working correctly, you should be able to access previously blocked tracker web sites and download .torrent files from them. Googling for 'Public Proxy' will provide plenty of public proxy IP addresses, but these proxies are not always functional or reliable. Instructions for configuring your web browser to work with a proxy are beyond the scope of this article, but Google should be able to help you with this.

    3. The Tor Network

      Tor, an acronym for 'The Onion Router', is another viable option. Although they sound similar, Tor and BitTorrent are not related. Tor is a public distributed proxy server that uses encrypted 'layers' to send traffic back and forth across the Internet between its many clients (potentially your computer) and exit nodes (individuals running Tor proxy servers.) Tor and its companion program Privoxy are available for most operating systems. Instructions for installing and configuring Tor/Privoxy are beyond the scope of this article, but very good instructions for doing so are available on Tor's web site. Once Tor and Privoxy are set up and running, you can configure your browser to use Privoxy: set your browser up to use an HTTP (not SOCKS) proxy running at IP 127.0.0.1 (your own computer) on port 8118 (Privoxy's default listening port.) If you're using Firefox, there is a handy extension called Torbutton that configures Firefox to use Tor/Privoxy automatically, and allows you to toggle between sending traffic through the Tor network or through your own regular Internet connection.

      Once your browser is proxying its traffic through the Tor network, you should be able access a BitTorrent tracker site the same way you normally would, as if your Internet connection were unfiltered.

    Out of these three methods for unblocking BitTorrent tracker web sites (or any other blocked sites,) the Tor method is the best choice. Although Tor takes the most effort to set up, it is also the option that is the most reliable.

Now that you've successfully acquired some .torrent files, you're ready for...

Section 2: Unblocking Actual BitTorrent Traffic/Getting the Content

Different aspects of the BitTorrent protocol may be blocked depending on your ISP. There is a fantastic page at the Azureus Wiki that describes how different ISPs treat and manipulate BitTorrent traffic. This article explains how to configure the Windows BitTorrent client μTorrent as well as the multi-platform BitTorrent client Azureus to function properly with an Internet connection that normally blocks BitTorrent traffic. Slight variations of the BitTorrent unblocking methods described below can potentially apply to any BitTorrent client or operating system.

Part 1: Setting Up the Connection

There are two methods described here for unblocking BitTorrent. One method involves proxying BitTorrent tracker/peer/seed connections through a shell server while the other involves proxying these connections through the aforementioned Tor network. Notice that there was no mention of proxying BitTorrent traffic containing actual file content--this will be explained in more detail later. These two methods should work equally well in theory, but you might have more success with one than the other, depending on how BitTorrent traffic is limited or controlled on your network. Note that when used below, the term 'client machine' refers to your own computer--the one running a BitTorrent client.

  1. Proxying BitTorrent traffic through a shell server (SSH)

    An SSH or Secure Shell server is a program that runs on an internet-connected computer, and lets users remotely access that computer. The idea behind this unblocking method is that your BitTorrent traffic will be encrypted and sent through a remote computer's unrestricted Internet connection, rather than directly through your own crippled Internet connection. You can either run your own SSH server by installing OpenSSH on a Linux machine that's not using the same Internet connection as the client machine, or you can get a shell account from a free or paid service (Google 'Linux shell account' or 'Linux shell service'.)

    Before trying this unblocking method, ensure that any firewall programs running on your computer are configured to allow incoming and outgoing TCP traffic on port 22. If you're not sure how to go about doing this or if you run into problems with this method, you can try temporarily disabling your firewall program.

    • If you're running Windows:

      You'll need to download the PuTTY SSH Client. It will be used to create a local proxy server on your computer that your BitTorrent client will connect to. This allows your BitTorrent client to use the shell server's Internet connection to accommodate BitTorrent traffic, rather than your own restricted Internet connection.

      Run PuTTY. You'll see a box labeled 'Host Name (or IP address)'. Enter the host name or IP of your shell server. Type '22' into the 'Port' box (this is the default port for SSH. If your shell server uses a different port, enter that number instead.)

      In the pane to the left of the PuTTY window, scroll all the way down to the bottom to select the 'Tunnels' page from the 'SSH' category. Under the 'Add new forwarded port:' heading is a box labeled 'Source port'. You can basically enter any four digit random number here--for example, 3958. Click on the 'Dynamic' radio button near the bottom right hand side of the window. Click the 'Add' button to the right. 'D3958' should show up in the 'Forwarded Ports:' list. In the pane on the left, scroll up and the 'Session' page. You should be back where you started when you first opened PuTTY. In the 'Saved Sessions' box, type 'BitTorrent'. Click the 'Save' button. Now, whenever you start PuTTY, your session settings will be saved and you can double click on 'BitTorrent' in the saved sessions list to automatically connect to your shell server, using the correct settings.

      Click the 'Open' button at the bottom of the PuTTY window to start the session and log in to the shell server using your username and password when prompted (you either created these yourself, or they were both given to you when you found and signed up for a free shell service online.) You should be presented with a console now, waiting for your input. You can now minimize PuTTY or let it run in the background.

    • If you're running Mac OS X, Linux, or another UNIX-like operating system:

      Using a shell server to proxy BitTorrent traffic is easier for you than for Windows users. Just open up a command line terminal, or Terminal.app in OS X, and type the following command:

      ssh -D [port number] [shell server username]@[shell server IP or hostname]

      For example, you could type ssh -D 3958 joeuser@foobar.org into the terminal. You can pick any four-digit port number you desire. After typing this line into the terminal, press enter. If everything goes to plan, you will be asked for your shell server password after a few seconds. After typing it and pressing enter, wait until a remote terminal prompt displays, then minimize the terminal window or leave it open in the background.

      This terminal command should work for you with no problems in Mac OS X (I've personally tested it with Mac OS X 10.5 Leopard,) but may give you problems in Linux if you don't have the OpenSSH client package installed. Quick Googling should yield instructions for installing OpenSSH for your particular Linux distribution.

  2. Proxying BitTorrent traffic through the Tor network

    Look for more information about Tor and its companion program Privoxy towards the bottom of Section 1 of this article. Tor and Privoxy require no special configuration to proxy BitTorrent traffic. Should you choose the Tor method, ensure that Tor and Privoxy are installed and are running on your computer before proceeding to the next part of this article.

By either connecting to an SSH server or by starting Tor, you've punched a hole through your ISP's BitTorrent blocking techniques. Now it's time to actually exploit that hole.

Part 2: Using the Connection

Now that you've created a local proxy on your computer by using SSH or Tor, your BitTorrent client needs to be configured to connect to it, thus unblocking BitTorrent. The instructions provided below outline this process for the popular BitTorrent clients μTorrent and Azureus. However, as previously stated, these instructions can be easily adapted and applied to other BitTorrent clients.

  • If you're using μTorrent:

    1. Start μTorrent and choose 'Preferences' from the 'Options' menu. Select 'Connection' from the pane on the left. In the 'Proxy Server' frame in the middle, select the 'SOCKS4' type from the dropdown menu. In the 'Proxy:' textbox, enter 127.0.0.1 (this is the IP of your own computer; μTorrent will connect to your proxy this way.)

    2. In the 'Port:' box:

      • If you're using SSH, enter whichever port you chose during Section 2, Part 2 of this article--possibly our previous example port of 3958.

      • If you're using Tor, enter port 9050, which is Tor's default listening port. In case you're curious, you don't have to worry about Privoxy: it is used to add additional privacy when using Tor for web browsing.

    3. Still inside the μTorrent preferences window, select 'BitTorrent' from the pane on the left. In the 'Protocol Encryption' frame on the bottom, choose 'Forced' from the 'Outgoing:' dropdown box. Make sure the 'Allow incoming legacy connections' checkbox is checked. Protocol encryption encrypts all BitTorrent traffic, masking it from your ISP (and hopefully causing your ISP to treat it as 'innocent' non-BitTorrent traffic.) You might find that simply enabling protocol encryption without using a proxy will be all you need to get BitTorrent working in your situation.

    4. Finally, click 'Apply'.

  • If you're using Azureus:

    1. Start Azureus and choose 'Options' from the 'Tools' menu (or 'Preferences' from the 'Azureus' menu on a Mac.) Expand the 'Connection' tree in the pane on the left, and select 'Proxy Options'. In the 'Tracker Communications' frame, check the 'Enable proxying' and 'I have a SOCKS proxy' checkboxes. In the 'Host:' textbox, enter 127.0.0.1 (this is the IP of your own computer; Azureus will connect to your proxy this way.)

    2. In the 'Port:' box:

      • If you're using SSH, enter whichever port you chose during Section 2, Part 2 of this article--possibly our previous example port of 3958.

      • If you're using Tor, enter port 9050, which is Tor's default listening port. In case you're curious, you don't have to worry about Privoxy: it is used to add additional privacy when using Tor for web browsing.

    3. Still inside the 'Connection' tree inside the Azureus preferences window, select 'Transport Encryption' from the pane on the left. Make sure every checkbox that appears is checked, and choose a minimum encryption level of 'Plain'. Protocol encryption encrypts all BitTorrent traffic, masking it from your ISP (and hopefully causing your ISP to treat it as 'innocent' non-BitTorrent traffic.) You might find that simply enabling protocol encryption without using a proxy will be all you need to get BitTorrent working in your situation.

    4. Finally, click the 'Save' button at the bottom left of the Azureus preferences window, then restart Azureus.

Try adding a .torrent file to your client's download queue. If everything went well, you should be able to connect to the tracker and in turn connect to seeds and peers, and start downloading and uploading content.

Troubleshooting

If things don't work, go over all of the configuration steps and settings described in this article a second time--there are a lot of them. If you're certain that they're correct:

  • If you're using SSH:

    You could be having problems if your shell server does not allow tunneling. If you're the administrator of the server, research how to enable tunneling over SSH and do so. If you're using a service, ask the administrator or other users of the service how to go about using tunneling. You could also try a different service. Things will work eventually.

  • If you're using Tor:

    Make sure Tor is running and reread the details about Tor towards the bottom of Section 1 of this article.

In my experience, both Azureus and μTorrent have been successful at encrypting BitTorrent traffic and tracker connections without using a proxy. Either of these two BitTorrent clients--or another client entirely--might get the job done for you. A client that works on one Internet connection and/or computer setup might not work permanently, or on another setup. If you absolutely cannot get things working, try a different client! Depending on your setup and software preferences, you can use any combination of proxy (including no proxy) and client that you're happy with.

Section 3: Etiquette and Wrap-up

It's time for the lecturing to start again.

As mentioned above, you should never proxy ALL of your BitTorrent traffic through a free shell server unless you have explicit permission from the server administrator(s). Not only will doing this yield extremely slow download speeds, but this also uses large amounts of someone else's bandwidth, and you're not paying for it. Only proxying BitTorrent tracker connections (as opposed to all traffic) is acceptable, as this uses very little bandwidth. In fact, in most cases you should only have to proxy tracker connections, because many ISPs block connections to trackers (that share information about peers,) but not connections to peers themselves.

If you've chosen to proxy traffic through the Tor network rather than through a shell server, note that you should never use Tor for anything besides proxying tracker connections and anonymous web browsing. After playing with Tor for a while, you might notice that it is generally much slower than your own Internet connection. This is because many of its users abuse Tor by proxying high-bandwidth BitTorrent content data or other peer-to-peer traffic through it. DON'T DO THIS. You'll make the problem worse and the Tor network even slower and less reliable for all of its users. Only proxy low-bandwidth tracker connections through Tor.

One last thing to note: when working with Tor and with public proxy servers in general, it's not a good idea to do things like check your e-mail unless you're using SSL (usually at a web address beginning with https://), because people running the proxy or Tor servers that you will connect to might be able to see, analyze, or manipulate your unencrypted Internet traffic.

All of that being said, I hope you found this article informative and useful. Be smart about what you do with BitTorrent, and never be afraid to experiment!


Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.


comments powered by Disqus