WWW FAQs: How can I distribute large files without using too much bandwidth?

2006-01-18: BitTorrent is the best way to distribute large files, such as videos and high-quality MP3s, without reaching the bandwidth limit of your web hosting account. BitTorrent uses a "peer to peer" strategy in which every user's computer contributes. While your computer is downloading the file from other "peers," it is also uploading the parts it has already received to peers who don't have those pieces yet.

This way, the web server doesn't have to deliver the file to every user. A "seeding" peer does have to stick around at all times to get things started when only one user is interested in the file, but the seeding peer doesn't have to be your web server -- it can be your computer at home, as long as you have a good connection and you're willing to leave it on 24-7.

Warning: running a server of any kind at home is a security risk. Security problems are sometimes found in server software, and these can be exploited to gain access to or damage your files. Your computer must be kept absolutely up to date with Windows Update or the equivalent for your operating system if you intend to run a BitTorrent server on it. This doesn't eliminate the risk -- it only minimizes it. You run a server at home entirely at your own risk. If you do choose to run a server at home, I recommend finding an old PC on the curb and setting it up as your home server, reducing the danger to your own computer.

Procedures for other operating systems are similar, and most of these steps actually involve your router, so this article should still be helpful to non-Windows users.

Here are the steps to follow to set up a torrent hosted entirely on your own Windows PC. First I'll present the general steps, then I'll break down the details for you:

1. Make sure you have cable modem, DSL or another high-speed connection. A dialup telephone modem is NOT good enough.

2. Get a DNS hostname for your home Internet connection.

3. Get a static local IP address for your computer within your home network.

4. Decide what port numbers you will use for both your tracker and your actual torrent.

5. Configure your router (or, in some cases, modem/router combo in a single unit) to correctly forward connections on the port numbers you chose to Azureus, the BitTorrent program we'll use here.

6. Configure Windows Firewall to allow Azureus to communicate on those ports.

7. Get Azureus, a free, high-quality BitTorrent client/server "peer" program.

8. Configure Azureus to use the BitTorrent port number you chose. Test the configuration.

9. Set up the built-in tracker feature of Azureus.

10. Create your torrent with Azureus. Be sure to configure Azureus to host your torrent.

11. Add a download link for your torrent from your website.

12. Test your torrent from a computer that is NOT on your home network to make sure you followed all of the steps correctly.

And that's it! Be sure to provide a link for users to download Azureus if they don't already have a BitTorrent client (any BitTorrent client will work).

Step One: Broadband

Get cable modem (from the cable company) or DSL (from the phone company and various other companies). If you can't do that, you'll have to host your files in some other way.

Your computer needs a fast connection to grapple with video and audio files anyway. You don't necessarily have to go with your phone company's DSL offering. Check out broadbandreports.com for independent reviews of cable modem and DSL companies. Upload speed, not download speed, is the most important feature for hosting torrents at home.

Step Two: Dynamic DNS

Other people can't talk to your BitTorrent "tracker" if they don't know the address... and if you have a typical cable modem or DSL connection, your address changes often. You can solve this problem by using a dynamic DNS service. This is a common requirement both for hosting websites at home and for hosting torrents, so I've written a separate article explaining how to get a hostname for your computer at home.

Step Three: A Static Local IP Address

If you have a router... and you do, if you have WiFi (wireless access) or more than one computer... then your computer receives a new local address on your home network, or Intranet, every time it is powered on. But to forward BitTorrent connections to your computer, you need an unchanging address to forward those connections to. This is also a shared requirement both for hosting websites at home and for hosting torrents, so I've written a separate article explaining how to give your computer a static local IP address.

Step Four: Choose Your Port Numbers

By default, BitTorrent programs listen for connections on the "port number" 6881. And BitTorrent trackers, which are often part of a larger website, often listen for connections on the port number 80. Both of these port numbers are bad choices for us.

Since port 6881 is unfortunately often used by those who are illegally sharing files, many ISPs "throttle" traffic on that port, slowing it down artificially. Some ISPs will detect BitTorrent data anyway on any port, but in most cases they will slow it down rather than blocking it completely. If they do block it completely... change to another Internet provider and tell them why! You are paying for bandwidth and they should deliver it. I suggest Speakeasy DSL, because of their friendly policies toward web servers and BitTorrent clients running on home computers.

As for port 80, it's true that some ISPs forbid web servers at home and will block traffic to port 80 entirely. But there's another good reason not to use it for a BitTorrent tracker: you might also want to host a website at home. And we don't want the built-in tracker of Azureus, the BitTorrent program we'll use, to conflict with that web server. So we choose an alternative port for the tracker.

Instead of 6881 and 80, Pick two numbers between 32768 and 65535 (for instance, 40156 and 40157, but don't use those two, pick your own). These will be your ports for the actual torrent traffic and for the "tracker," a simple built-in web server that negotiates the beginning of every torrent connection. Write them down and move on to the next step.

Step Five: Forwarding Ports

If you have a router, you must follow this step. But do you have a router? These days, the answer is often "yes," even if you're not aware of it.

If you have WiFi, or more than one computer connected to the Internet by any other means, then you definitely have a router (even though it might be built right into your modem) and you must not skip this step. Note that even if you have just one computer, the presence of more than one jack to hook up additional computers or the presence of a wifi antenna on your Internet connection device means that it is definitely a router.

Now that you have chosen a static local IP for your computer and chosen the port numbers you want to use, you're ready to configure the router to forward traffic on the port numbers you've chosen. The router will forward that traffic from the Internet to your computer.

Again, this step is needed both for web hosting at home and for BitTorrent hosting. So, once again, there is a separate article explaining how to forward ports from the Internet to your computer via your router.

Step Six: Allowing Traffic Through The Firewall

More firewall issues? Didn't we already do this? Only in part. Yes, your router serves as a firewall, but your computer also has a built-in firewall. You'll need to configure that firewall to allow traffic through on the two ports you have chosen for BitTorrent and tracker traffic. This step is also common to both web hosting and torrent hosting... so check out my article explaining how to allow traffic on specific ports through your computer's firewall.

Step Seven: Get Azureus

Azureus is the best BitTorrent client around, with excellent features for fetching files, hosting torrents, and tracking torrents. And since it's written in Java, it works on Windows, MacOS, Linux and more. And, it's free and open source software! I can't say enough about this fantastic program.

There is no separate BitTorrent "server" program. All BitTorrent "clients" are really "peers" in a cooperative network. Azureus also includes the server features needed to get things started.

Download Azureus from azureus.sourceforge.net. NEVER download Azureus or another BitTorrent client from ANY other source -- there are some nasty spyware-laden versions going around! If the Azureus download page doesn't tell you that you already have Sun's Java runtime environment, you'll need to download and install that too. Java is easy to install on Windows, standard equipment on Macs, and available for Linux and other systems as well.

Of course, you can also use the original BitTorrent program, which includes the ability to make new torrents but doesn't act as its own tracker. A new "trackerless" system is available, but I've had no luck making it work. And the various BitTorrent programs don't agree on how trackerless torrents should work, so by using them, you limit the audience for your files. In a word: ick. Use Azureus, and use the built-in tracker facility, not a trackerless torrent.

Step Eight: Configure Azureus To Use Your Port Numbers

As mentioned earlier, Azureus tries to use port 6881 by default, and that's not a great choice. Configure Azureus to use the ports you have chosen (substitute the port numbers you chose for my examples in the following steps):

1. Launch Azureus if you haven't already: Start -> Azureus -> Azureus

2. If you do not see the "Configuration Wizard" window right away, pull down the "Tools" menu and pick "Configuration Wizard." The "Configuration Wizard" window appears.

3. Pick "Intermediate." This mode allows us to host our own torrents.

4. Click "Next." The "Transfer and Connection setup" page appears.

5. Honestly answer the question about your upload speed. Making up bigger numbers will just make the program work badly. If you're not sure what your speed is, ask your ISP what your upload speed is. Your upload speed is usually much slower than your download speed. Cable modem usually has an upload speed of 384kbps, but upload speeds can be as low as 128kbps.

6. Click "Next." The "NAT / Server Port" page appears.

7. In the "Incoming TCP Listen Port" field, enter the port number you chose for BitTorrent traffic (for example, 40156). Click "Test." If you get a "NAT Error" message, you probably did not forward the ports through your router correctly. Fix that before continuing.

8. Click "Next." The "Torrents / Files" page appears, suggesting a location for your torrent files. You can choose any location or just accept the default by clicking "Finish."

9. The message "Azureus is now configured, have fun!" appears. But we're not done yet! We need to set up our tracker.

Step Nine: Configuring the Built-In Tracker Of Azureus

No one can find your torrent without a tracker to keep track of participating "peers" who have part or all of the file to send. Fortunately, Azureus has a built-in tracker feature. But it's not turned on by default. Here's how to turn it on and configure it correctly:

1. Tools -> Options

2. Click on the "+" sign to "Tracker" in the tree of options on the left. It becomes a "-" sign with "Client" and "Server" beneath it.

3. Click on "Server."

No, a hostname is not an IP address and yes, you really do need to put your hostname here. It's just poor phrasing in the Azureus user interface.

4. In the "Tracker external IP address" field, enter the DNS hostname you signed up for when you followed the steps in the how to get a hostname for your computer at home article.

5. Check "Enable tracker on HTTP port." In the field immediately to the right of this checkbox, enter the port number you chose for your tracker. (40157 in our example, but you chose your own... right?) Leave the "Backup ports" field blank.

6. Click the "Save" button in the lower left corner.

7. Verify that your tracker port has been forwarded through the firewall properly. To do that, pull down the "Tools" menu and pick "NAT / Firewall Test." You've seen the "NAT / Server Port" window before, but here we're just using it to test a port. Enter your tracker port number (again, 40157 is just my example, you chose your own earlier) and click "Test." If you get a "NAT Error" message, double-check that you forwarded ports through your firewall correctly.

Step Ten: Create Your Torrent With Azureus

We're ready to create our torrent! It's not hard, but we do have to be careful to check the right boxes to allow Azureus to host and track the torrent by itself. Just follow these steps and we'll be almost done!

1. Pull down the "File" menu of Azureus and pick "New Torrent." The "Tracker / Mode" page appears.

2. Check the "Use Azureus Embedded Tracker" button.

3. You can share single files or entire folders. Decide which you want to do and click either "Single file" or "Directory."

4. Click "Next." "Single file" or "Directory" appears.

5. Use the "Browse..." button to select the file or folder you want to offer. (You do want to offer something for downloading, right? That's why you're here!)

6. Click "Next." "Torrent File" appears.

8. Azureus will suggest a name and a location for the "torrent file." This is a very small file that tells BitTorrent programs how to get the real file. Usually the default name and location are just fine. But don't click "Next" yet! We have to make sure Azureus knows it is responsible for "seeding" the file so that there is always at least one peer to start the uploading process.

9. Check the "Open the torrent for seeding when done" checkbox.

10. The "Host the torrent on the built-in tracker" box becomes available. Check that box also.

11. Click "Finish."

12. Status information appears. Click "Close" to complete the process.

13. Click the "My Torrents" tab just below the toolbar in the main Azureus window. You'll see your new torrent listed with "Seeding" in the "Status" area.

Congratulations, you've created a BitTorrent! All you need to do now is tell the world where to get it. We'll do that with a simple HTML link from your main website to your BitTorrent tracker.

Step Eleven: Link To Your Torrent From Your Website

Great, you have a torrent! How do other people access it? All they need is the URL of the torrent file. The simplest way to give them that information is to link to the torrent from your main website.

But what is the URL of the torrent file? Good question. The easiest way to find out is to visit your tracker with your own web browser. Just fire up your web browser and access:


Be sure to substitute YOUR DNS hostname and YOUR tracker port number for the example name and port in this URL. If you don't understan this, you probably didn't complete all of the steps above. Go back and do so.

When you do this successfully, Azureus will show you a nice page that lists all of your torrents. You could simply link directly to this page from your website, like this:

<a href="http://mysitename.is-a-geek.com:40157/">
You can download my band's sample MP3s with BitTorrent by clicking here!

You can also link to individual torrents so that the user never sees this page directly. To do that, just right-click on the name of your file in the "Torrent" column at the left, and select "Copy Link Location" (Firefox) or "Copy Shortcut" (Internet Explorer). Now you have a link that starts that particular torrent download directly:


I have inserted a line break for readability.

However, you don't need the ? and the letters and numbers that follow it. These are generated randomly to avoid issues when the link is followed more than once -- they don't accomplish anything if you copy and paste them anyway. This link will work just fine:

<a href="http://mysitename.is-a-geek.com:40157/torrents/mysong.mp3.torrent">
Download our hit single now with BitTorrent!

That's that -- your torrent can now be downloaded by anyone with a BitTorrent client! Since not everyone has BitTorrent software yet, I strongly recommend providing a link to the Azureus download page on your site.

Before you celebrate, though, make sure your torrent really works from the outside world. There's no other way to be 100% certain you have followed all of the configuration steps correctly!

Step Twelve: Test Your Torrent From The Outside

The final step: follow that torrent link from a computer that is not in your home and see what happens. If the computer in question has BitTorrent software, your file should be downloaded. If it isn't, you probably made a mistake in dynamic DNS, port forwarding, firewall configuration or local static IP configuration.

Congratulations! You've published your file in a way that can reach millions without running up hefty charges with your web hosting company. Just remember: your computer must remain on, and connected to the Internet, all the time. Without a tracker, and without your computer to act as a "seed" peer when no other peers are around, there's no torrent. That's why I recommend picking up an older computer off the curb, dusting it off, popping in 128MB of RAM and firing it up as a BitTorrent server. Your own PC doesn't wear out, and if security problems are found in Azureus, they are more likely to be confined to the less important computer.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!