Ctorrent
From WL-HDD Wiki
| WL-HDD Contents |
|---|
| What is the WL-HDD |
| Features |
| Pro's/con's |
| Reviews |
| Hacking |
| Inserting the HDD |
| Hacking Guides |
| Basic setup guides |
| Packages guides |
| Requests |
| Troubleshooting |
| This Wiki |
| Credits |
| Editing help |
| Contact Me |
Contents |
[edit] Prerequisites
To complete this guide, the following is assumed:
| You are running Oleg's firmware (1.9.2.7-6b or later) |
| You have harddisk partitions up and running with an extended filesystem mounted to /opt |
| You have installed the Ipkg package system. |
| You have configured your partitions to automount. |
[edit] Install Ctorrent
Apart from the ctorrent package, it is also recommended that you install the coreutils package on your WL-HDD. This allows you to make use of the nohup command so you can close your terminal and the torrent will continue to download.
ipkg update ipkg install coreutils ipkg install ctorrent
Now go and find a torrent file on the web, make sure there are plenty of seeders.
Get the torrent file onto your WL-HDD using wget, ftp or samba. For example:
wget http://www.torrentsite.com/torrent.torrent
Make a note of where the torrent file is saved.
[edit] Change the Firewall
You need to allow incoming connections on your WL-HDD on port 2706. Lets edit the post-firewall file.
nano post-firewall
This rule just allows torrent connections:
#!/bin/sh iptables -D INPUT -j DROP iptables -A INPUT -p tcp --dport 2706 -j ACCEPT iptables -t nat -A PREROUTING -i vlan1 -p tcp --dport 2706 -j DNAT --to-desination $4:2706 iptables -A INPUT -j DROP
The following rule allows ftp, ssh and torrent connections:
#!/bin/sh iptables -D INPUT -j DROP iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A INPUT -p tcp --dport 21 -j ACCEPT iptables -A INPUT -p tcp --dport 2706 -j ACCEPT iptables -t nat -A PREROUTING -i vlan1 -p tcp --dport 22 -j DNAT --to-destination $4:22 iptables -t nat -A PREROUTING -i vlan1 -p tcp --dport 21 -j DNAT --to-destination $4:21 iptables -t nat -A PREROUTING -i vlan1 -p tcp --dport 2706 -j DNAT --to-desination $4:2706 iptables -A INPUT -j DROP
Now make sure you make those changes permanent:
flashfs save flashfs commit flashfs enable
[edit] Virtual Server
If you are (as in most cases) behind a router, you will need to configure port forwarding on your router. This is normally done on the web administration pages.
You will need to forward port 2706 (TCP) to the LAN IP address of your WL-HDD (192.168.my.ip) to allow incoming peer connections.
If you are planning on downloading multiple torrent files on your WL-HDD then you will need to forward more ports. Ctorrent tries ports in the range 2106 to 2706 so the next port to forward would be 2705 then 2704 and so on. One port for each torrent you will be downloading. You will of course have to add new rules for each of these ports forwarded (or specify a range of ports) in your post-firewall file or the WL-HDD will block connections.
[edit] Testing it out
The command to run is:
ctorrent /opt/home/mytorrent.torrent
You should see a progress bar telling you how much data has been downloaded along with some more information.
Note that if you close the terminal, ctorrent will end. Likewise, you cannot use the terminal until the torrent has finished downloading.
A better command to use is the nohup command:
nohup ctorrent /opt/home/mytorrent.torrent &
It will tell you that it will save the output to a file called nohup.out. Make sure you delete this file after the torrent has downloaded.
After a minute or so, it is safe to close the terminal, the torrent will continue to download in the background.
[edit] Minimalise Seeding
If you would rather not keep sharing a torrent after you have finished downloading it (seeding), you can attach the -e 0 flag to the ctorrent command where 0 is the number of hours you wish to seed for.
ctorrent -e 0 /opt/home/mytorrent.torrent
There is probably still more to be written on this guide but it should be enough to get you started. I haven't really tested out ctorrent much yet. I would be glad if others could contribute. Jono 14:09, 7 June 2006 (BST)
[edit] Comments
Ctorrent has a 2GB file download limit. There's an enhanced version of CTorrent here: http://www.rahul.net/dholmes/ctorrent/
This has now been built into an optware package and can be installed on the WL-HDD using the command:
ipkg install enhanced-ctorrent
-- EFM. Tue Aug 15 12:18:40 UTC 2006
