Space Menu Home Downloads Newbie Area Documentation Knowledge Base E-Training Forum Blogs Chat RPMs Farm Linux Events
HistoryHistory |
View
Code | XML |
Help
XWiki Syntax |


BitTorrent

Description

This walkthrough is intended to bring together all the help provided in Mandriva Club and elsewhere into one place.

Please read through the whole of this walkthrough, so that you can decide which is the best way for you to go based on your level of experience.

Bittorrent is a Peer-to-Peer protocol which allows the download of data and has found a lot of use in distributing very large files, in this case Mandriva ISO's.

Unlike FTP access where you are dependent on available bandwidth (and the number of people downloading at any one time) Bittorrent users are downloading from each other, as well as uploading to each other. In this way you will hopefully avoid the flooded FTP servers when a new Mandriva comes out, as well as being able to get the ISO's before they are available to the general public via the Mandriva Club torrent files.

Using Bittorrent will also help Mandriva in terms of reducing the need for costly bandwidth and hardware for download servers. As more people regularly provide their maximum possible upload bandwidth, the faster the downloads will get for everyone!

The BitTorrent files from the Mandriva Club are limited in time. So if your download is already very slow, reopen the BitTorrent file from the Mandriva Club download page after some time.

Please remember that for Bittorrent to work, every connection is important - in other words the more connections, the faster and better for everyone. So please keep your connection going for as long as possible (or resume after you have installed!) so that others can benefit as you have done. Thanks! :-)

The Club forum is here to help! Any problems - please post!

Installation

What do I need?

  1. You will need a .torrent file containing details of your selected ISO (see below).
  2. You will also need a BitTorrent client (application) to manage the actual download itself.
  3. It may be obvious but you need enough space in the partition you are downloading to.
(If downloading to a Windows partition, bear in mind the maximum file size limit in FAT32 is 4Gig, which is not enough for a Powerpack DVD ISO!)

Where do I get these from?

A .torrent file

Your .torrent file is available from http://club.mandriva.com/xwiki/bin/Downloads/MyTorrents. Simply select the ISO of your choice and download the file, which will be called....

mytorrent-(your username).torrent

(Please note that this file is unique to you and your current internet address. This means that in most cases if you log off or disconnect from your ISP, this file will no longer be of any use to you and you will have to download another .torrent file from the above page. This is not as bad as it may seem see below).

B BitTorrent client

There are various BitTorrent clients that you can use (link details below) but for the purposes of this article we will use the most common - the latest BitTorrent RPMS and Azureus.

  • The main BitTorrent RPM and GUI RPM (plus their dependencies........wxPythonGTK and libwxPythonGTK RPMS).
You can obviously download the packages seperately if you want to ;-) but the easiest way to get these RPMS installed is either through Mandriva Control Centre > Software Management > Install or using the 'dreaded' commandline (logged on as root) with the command: -

urpmi bittorrent-gui

Both these methods will get the BitTorrent packages and dependencies for you, but although they are in the 'Main' repository make sure you have a 'Contrib' mirror in your source list. This is easy! Simply go to… http://club.mandriva.com/xwiki/bin/Downloads/MirrorFinder and follow the instructions to install the mirror(s).

  • Azureus
To use Azureus, you must have the latest Java package installed. Simply go to Mandriva Club RPM Download page and download the latest J2re rpm.

Then download Azureus from Sourceforge

Place the tar file in the directory of your choice. Use a GUI program such as Ark to extract the files into the directory. If you prefer the commandline, use the command: -

tar xvjf Azureus_x.x.x.x_linux...tar.bz2

This will place the Azureus folder into the directory. Change to the Azureus directory and through the GUI double-click on the Azureus shell script, or from the commandline, go to the directory containing Azureus and type

./azureus

The first time Azureus is run, you will get the Configuration Wizard, like this: -

http://uk.geocities.com/[email protected]/snapshot6.jpg

When you have completed configuration (following this walkthrough), you can open a .torrent file and begin your download, which will look something like this: -

http://uk.geocities.com/[email protected]/snapshot3.jpg

(Azureus potentially contains a lot of information which it can display graphically and as such it is advisable to check out the home page for full details of what's available. Please see the Azureus homepage).

Where can I find a Windows or Linux alternative?

There are many others as well. The Bittorrent FAQ is a perfect place to find a BitTorrent client:

http://www.dessent.net/btfaq/#where

So that's it then?

No – there needs to be a little tweaking to get the best download performance. The most important points to note are: -
  • you need to open certain ports in your firewall to allow Torrent connections.
  • you need to specify your system's upload speed, otherwise your download speed will be adversely affected (due to the peer-to-peer nature of the torrent).

What ports are needed?

Mileage varies here with the main port being port 6881. However opening the below ports have been reported to assist in getting best speeds: -
6881-6889
6969
and 7070

What upload speed shall I set?

Your upload speed should be set at 80% of your connection's maximum upload capacity. For instance, on a 512k ADSL line, the upload limit to set for BitTorrent should be between 10 and 12KiB/s. On a 1024k ADSL line, 20KiB/s has been reported as giving good results. If you have an even faster 'pipe', set at 80% of upload capacity or tweak away, but remember that you are penalised if you restrict upload speed too much, after all it's a peer-to-peer system!

Everything set, so how do I start the download?

Open the Bittorrent GUI window by going to the directory where your .torrent file is and use this command (but remember to change the upload rate to your correct setting!): -

btdownloadgui.py ––max_upload_rate 12 mytorrent-yourusername.torrent

Select 'Open with' > 'OK'

As from the latest Bittorrent RPM at time of writing (May 2005* Bittorrent v4.01) there is now a slider within the GUI which does the same as the above commandline, which makes things even easier: -

http://uk.geocities.com/[email protected]/snapshot2.jpg

Typically the download will start slowly, so don't get put off if you see 100hrs+ estimated time left to begin with! You will connect to peers and after a while (all things being equal) the download will increase in speed. This download speed will fluctuate throughout the whole download process, depending on how many peers and seeds are available to you, internet traffic, ISP bandwidth throttling, etc.

One of the reasons why some people experience slow speeds is that some folks simply disconnect from the torrent as soon as they have downloaded their file, instead of leaving it running for a while to allow more upload/transfer to others.

Can I use a browser?

If you click on a ".torrent" link from your browser, the bittorrent downloadclient should start and download the target of the torrent-link automatically. But most browsers by default are not configured to handle ".torrent" links.

To configure Mozilla, go to "Edit > Preferences > Navigator > Helper Applications". Click on "New Type" and specify a new MIME Type "application/x-bittorrent", with Extension ".torrent". Click on "Open it with" and enter "btdownloadgui.py" in the box. Click OK and close the preferences window.

To configure Opera, go to "File > Preferences > File Types" and click on "New". Specify a MIME Type "application/x-bittorrent", with File extension ".torrent". Click on "Open with other application" and enter "btdownloadgui.py" in the box. Click "OK > Apply > OK" to close the preferences window. For most browsers the procedure is similar as with Mozilla/Opera.

If you install mailcap-2.0.4-9mdk or higher, the above steps won't be necessary for most browsers. Download it from the Mandriva RPM Download Page

Common Error Messages

'404 Not found'

  • Your internet address may have changed since you downloaded the .torrent file.
Line dropped? Had to disconnect? Simply re-download the .torrent file!

Don't worry – you will NOT have to start from the beginning, as the BitTorrent client will check the download so far and then resume from where you left off! (phew!)

  • Your ISP may be using a Transparency Proxy where your true internet address is behind your ISP, so the tracker cannot see it.
It may clear this problem if you forward the torrent data to the correct address. This is particularly relevant if you are behind a router. Go to the Club torrent main page..... http://club.mandriva.com/xwiki1/bin/view/Downloads/MyTorrents and copy your internet address. Then, open a terminal as root and paste the internet address into the following command: -

iptables -t nat -I PREROUTING -p tcp ––dport 6881:6889 -j DNAT –– to your_current_ internet_address*

You can check if your Internet connection uses a proxy on this page: http://www.lagado.com/proxy-test

ISO's are not working

Every ISO has an md5sum file attached to it which contains a 'sum' of the original ISO, based on an algorithm. With this md5sum file you can check the byte-for-byte integrity of the downloaded ISO, by checking the md5sum file against the downloaded ISO file.

If the md5sum of the ISO does not match the posted md5sum, then the download is corrupted that is it is not a true copy of the original.

Always verify your download! Although Bittorrent checks file integrity, it is still advisable to check the md5sum before you burn to CD/DVD. See http://www.linuxiso.org/viewdoc.php/verifyiso.html

(For information, the burner software K3b can also check the ISO md5sum for you, prior to burning).

Some md5sums: -

132d0fea15e901f4ef7f1a9647a77d49 
Mandrakelinux-10.1-Official-Powerpack-CD1.i586.iso19d00e9fcbaad73e1b082b26f28695d1 
Mandrakelinux-10.1-Official-Powerpack-CD2.i586.iso85c08d954186531363e8533e107d8897 
Mandrakelinux-10.1-Official-Powerpack-CD3.i586.isoc06ecf43e722b37c90e4ba14a0b68302
Mandrakelinux-10.1-Official-Powerpack-CD4.i586.isoefe85416a3f3d69e8b0931e7db604377
Mandrakelinux-10.1-Official-Powerpack-CD5.i586.isoe72652acaeb21059a536d3d6fb8a3055
Mandrakelinux-10.1-Official-Powerpack-CD6.i586.iso

1.1'Bad file info'

You may not have downloaded the torrent file properly. The file needs to be named 'mytorrent-yourusername.torrent' and have 'd8:announce95:' at the beginning of the file. This problem is normally avoided by clicking on the provided links.

A similar error is caused by saving the torrent files with "End Of Line" (CR+LF) characters in Mozilla 1.4 and 1.5rc2. The files may be fixed by using the 'dos2unix' command, or manually remove the characters by hand. Another solution is to download the files with Konqueror or Opera instead of Mozilla.

!–– "I am using Mandriva but I'm not able install the 'bittorrentgui' package"

Use the bittorrent package which provides a command line 'ncurses' version. The GUI version doesn't provide any additional features yet requires 'wxPythonGTK' and 'libwxPythonGTK2.4' (which is located in Contribs). Some members have experienced problems because two different python packages were installed at the same time.

To use BitTorrent from the command line, you just need to enter the following at a console (but remember to change the upload rate to your correct setting!): -

btdownloadcurses.py –max_upload_rate 12 mytorrent-login.torrent

'Import Error-No module named BitTorrent'

The problem may occur if one replaced python2.2 by python2.3, the BitTorrent modules will not be found, since the default search path is different. In this case, setting the environment variable PYTHONPATH to "/usr/lib/python2.2/site-packages/" may help (Note: this is dependent on the version of your BitTorrent rpm, but setting this variable doesn't hurt in any case)

'General problem with download'

Due to unpatched software or hardware errors the download can stop or be slow. So restart your Torrent client program. It could help to stop and start a Torrent download or toggle the force to download (context menu option).

Advanced

Configuring bandwidth rates with trickle

Currently, bittorrent has no option to limit the overall upload rate for several clients at once. However, it is possible to accomplish this with "trickle". Install the trickle RPM from Club and start the daemon with: 'service trickle start'.

You can now start your download clients with 'trickle btdownloadgui.py file.torrent', or put 'trickle btdownloadgui' in the MIME-setting of your browser, as detailed above. The overall bandwidth of all clients will be limited by the trickled daemon.

Configuring bandwidth rates with CBQ

There is also a possibility to configure your bandwidth at kernel level in much more detail with Fair Queueing with 'CBQ'. You can download an init script at: - http://sourceforge.net/projects/cbqinit

Put the initscript in /etc/rc.d/init.d/ and put the below example configuration in the file

/etc/sysconfig/cbq/cbq-104.bittorrent-client0

DEVICE=eth0,10Mbit,1Mbit
RATE=104Kbit
WEIGHT=10Kbit
PRIO=5
RULE=,:6881
RULE=,:6882
RULE=,:6883
RULE=,:6884
RULE=,:6885
RULE=,:6886
RULE=,:6887
RULE=,:6888
RULE=,:6889
RULE=:6881,
RULE=:6882,
RULE=:6883,
RULE=:6884,
RULE=:6885,
RULE=:6886,
RULE=:6887,
RULE=:6888,
RULE=:6889,

Read the information in the initscript to configure CBQ for your system. The main drawback of using CBQ is that it's so much more difficult to configure than trickle. The advantage is that, if you know how to configure it, it is much more flexible.

Shorewall firewall

"As far as speed, I have a Linksys BEFSR41 router. I opened ports 6881 6889, but I was only getting about 50 to 80kbs. I took the router out and connected the computer directly to the modem, and speed jumped to 380Kbs on a 3.5mbs cable connection. Very Nice."

“PS if you are using shorewall add the following rule DNAT net loc:192.168.1.1 tcp 6969,6881:6999"

"The correct syntax is explained in the file /etc/shorewall/rules itself… Put the following line in /etc/shorewall/rules net fw tcp 6881:6889,6969 (Don't forget to restart shorewall). I've also opened same ports in my DSL "router" (don't know if that was needed anyway, but it works now...)"

"Although shorewall uses "loc" for the local machine, Mandrake might configure the local machine as "fw" (firewall), as it happened at my machine. In this case, the following rule seems to work well in order to speed bittorrent downloads: ACCEPT net fw tcp 6881:6889,6969 * (put it in the apropriate location at the file /etc/shorewall/rules)." (by Kadjo)

Job for every day

If you want to make the BitTorrent downloads faster you could help us to accomplish this. If you have a flat rate internet access where you will not get extra costs then why not contribute your internet bitrate to the Mandriva BitTorrent. Every day you could do the following job:
  1. Open some of those BitTorrent files from the Mandriva Club CD download page, which you have already downloaded
2. Select your BitTorrent tool (e.g. Azureus in Windows)
3. If the download does not start, click on 'force download' button or in the context menu
4. Limit the speed or stop other uploads to have more speed for Mandrake CDs

Links

  • For more details about Bittorrent you can check out the BitTorrent homepage .
  • Upgrade from Standard to Silver level to download the Power Pack ISOs (but don't want to pay too much) the system can extend your current membership at the higher level with a fair calculation (i.e. on $60, there is $5 USD month remaining on your standard membership + extra month(s) $10 USD per month): Membership
  • Source code and binaries for other systems can be found here: Bitconjurer
If you have any updates or amendments, please PM Dutch or post on the forum - thanks!

Bittorrent Walkthrough by Dutch

Thanks go to the original posters of this info * Shahrooz, Kadjo, Maxim Heijndijk, Fafane and everyone else who contributed)!

Legal: This page is covered by the GNU Free Documentation License . Standard disclaimers of warranty apply. Copyright LSTB and Mandrivasoft.

 
Comments: 26 comments ...