PDA

Bekijk de volledige versie : How-to: Use your router as a BitTorrent Client



GerardNL
23-12-2006, 22:12
The main reason for me to choose for the Asus router was the BitTorrent client that was mentioned in several hundred reviews. However, as we all know, the one supplied by Asus is "less then perfect" and we still end up having to run our PCs 24x7 to get all those Linux distributions (or other type of downloads.... :D )

Thanks to the excellent work of K.C. (kfurge), we’ve gotten a whole lot closer to this dream. Now we have a descent telnet service and the option to install packages. It is now possible to run a torrent client on our server!

Several people already worked out how to get the below to work and hal2k1 already did quite a good job to explain how it’s done, but by putting it in the how-to section and explaining it in a bit more detail, it will hopefully be more accessible for other users as well.

For this how-to, I assume that you have some basic Linux knowledge. Like the ability to start a program or to traverse through directories.

So, that’s enough for an intro, now on to the interesting stuff:

1. The first thing to do is install the 1.0.4.6 custom firmware on your router. K.C. already wrote a nice manual for that. Start reading here: http://wl700g.info/showthread.php?t=7109

2. Telnet into your router (if you didn’t already do that)

3. Now you have all that running you’ll need to install 2 more packages: “screen” and “enhanced-ctorrent”.

Before you install these 2 programs, let me explain what they do:

The screen program is a virtual telnet session to your router. A bit like terminal services on Windows, but then textual based. So you can start a program inside this virtual telnet session, logout and later resume the session (even from another computer). The screen program has been around for a long time and is used for programs that need a long time to run like compiling a big program or to analyse SETI-data. The BitTorrent client is in the same category: It doesn’t require much interaction with the user, but from time to time you want to see the progress.

The enhanced-ctorrent client is a variation on the ctorrent program. The ctorrent program is actually the program that our ASUS router was using. This program was ok for it’s time, but the project is now asleep. Logically the enhanced version is better and still maintained so a much better way to go.

Now you know the 2 programs, it’s time to install them:

4 . The command for this is:

ipkg install screen
ipkg install enhanced-ctorrent

Testing the screen program:
Now you have the programs installed, you can try out the screen program. To start it, just type “screen” (without the quotes). As you see, the program simply starts with a fresh screen in your telnet session. Type a simple command like “ls”, just to get something on the screen.

Now press ctrl+d and ctrl+a

You should now see on your screen “[detached]” and the prompt again. Now you type exit to close your telnet session.

Start again your telnet session and logon to your router. Now type “screen –r” (the R stands for resume) to resume an earlier screen session.

As you can see the output of your earlier ls command is still there, including all the settings etc. So by pressing ctrl+d and ctrl+a again, you’ll detach the screen and “screen –r” you get back to it. If you don’t need the virtual screen anymore, you can simply type “exit” when you are inside the virtual screen and the virtual screen will stop (so no more screen to resume to).

I hope that the above makes it clear how the screen program works and how it is useful for all kind of long running programs.

Testing the enhanced-ctorrent program:
Before we can test this program, we’ll need a torrent file. To test this, find a torrent file that points to something popular and small. Ebooks are usually a good one to use. Download the torrent file with your webbrowser and place it somewhere on your router shared directories.

For example, place the file here: \\WL700gE\Myshare1\Download

(I assume that you are still logged into your router via telnet).

Go to that same directory: cd /shares/MYVOLUME1/MYSHARE1/Download

The enhanced-ctorrent program doesn’t need any complicated parameters to start.

Just type “enhcanced-ctorrent filename.torrent” and the download will start.

The first thing it will do list the content of the torrent file: Which files does it contain.
For all these files it will reserve the space already on your router. If you download for example an ISO file of a DVD, a 4gb file will be made in your hard drive, but will not actually contain anything yet.

At the bottom of the screen, you’ll see something like this:

Already/Total: 0/9 (0%)
Listening on 0.0.0.0:2706

So, you’ve already downloaded 0 of the 9mb of the file (since you just started with it) and that the program is listening on that port for clients.

The next line will be something like:

\ 0/18/0 [1/719/686] 0MB,0MB | 0,0K/s | 0,0K E:0,1

Have a look here (http://www.rahul.net/dholmes/ctorrent/userguide.html) for more details on what this exactly means, but it will give you very basic information and see that the download is in progress. The first character changes from / to – to \ to | just to give you a limited indicator that the process is still alive.

Like most torrent downloads, they seem to work best if you don’t look at them, this is where the screen program comes in.

For now, just press ctrl+c to stop the torrent client. You will now have your prompt again.

Start the screen program and now start the enhanced-ctorrent program again with the same command as before.

The first thing the torrent client will do is to check the file that was earlier downloaded. You’ll see something like this: “Check exist: 3/9”.

Once the entire check has been completed, it will resume the download and will show something like this:

Already/Total: 3/9 (33%)
Listening on 0.0.0.0:2706

The download continues now until it’s completed. Once that is done, it will tell you that on the screen and will still continue to seed for 72 hrs. After that point the program will automatically exit.

You can change the way the enhanced-ctorrent client works with a couple of parameters, this page (http://www.rahul.net/dholmes/ctorrent/userguide.html) will give you the parameters. Specially the upload and download limits would be useful. For example, adding “-U 15 –D 60” will limit your upload to 15 KB/s and download to 60 KB/s.

I hope that you understand how using this program together with screen will help you download stuff on your router without your PC running.

I know it’s not as nice and fancy solution as a program like utorrent or Azureus, but it does the trick.

Good luck with the download and let me know if I forget to include something in this here.

back2basic
05-01-2007, 14:52
First of all thanks for writing this How To:

And to all who are making this beautifull white box into a monster ... You are doing a hell of a great job

I have a little problem with my firewall...
when I disable the firewall on the webpage all is going great
when I enable the firewall and set portforwarding 2700:2710 --> 192.168.1.1(Router) It gives me a error in enhanced-ctorrent because I'm downloadin from private trackers and they can't connect to me so can't downlaod from them

My question is how to set up my firewall correct in this beast so everything is protected

Grtzz
Ron


(EDIT) did someone already testet how many torrent's can be ran at the same time ??
I'm currently running 6 torrents all is going well ad my box makes a lot of noise AND fast speeeeeeeds

dolphine
05-01-2007, 20:08
I have a little problem with my firewall...
when I disable the firewall on the webpage all is going great
when I enable the firewall and set portforwarding 2700:2710 --> 192.168.1.1(Router) It gives me a error in enhanced-ctorrent because I'm downloadin from private trackers and they can't connect to me so can't downlaod from them


Isn't it better to OPEN the ports to your WAN address than to forward them to the LAN?

see my other post in iptables topic, but generally
iptables -I INPUT 7 -p tcp --dport 2700:2710 -j ACCEPT
should do the job for 2700-2710 work

Anyway, due to masquerade is could work also with FW on and no port open

BTW: enhanced-ctorrent uses 2706-2106 as default

Unofrtunately, I am almost unable to get any download to reasonable speed (5-10 times slower than utorrent behing the router) - even disabling the firewall does not work :-(

back2basic
05-01-2007, 21:07
thx It worked :)
my download is only 2-3 times slower than utorrent

dolphine
06-01-2007, 10:01
thx It worked :)
my download is only 2-3 times slower than utorrent

I'm not downloading that much to check - but I suspect that utorrent DHT feature makes the difference (it sees much bigger number of peers). As my line speed is 10Mbit symmetrical it can boost the DL speed to over 500kbit/s with some torrents whereas enhanced-ctorred gets maximally 60-70.

Other reason could be the torrents/trackers I'm downloading from - usually public with few seeds/peers (I guess that's where DHT helps utorrent to find other peers/seeds).

back2basic
06-01-2007, 14:13
as I mentioned before I only download from private trackers so I have DHT always disabled
My line speed is adsl2+ max20Mb a good 1600KB down and max 120KB up
when I download on my pc I gat a speed of 1000 down agains 55 up
but when I download with my router the speed is changing to 700 down and 250 up... How can my router upload @ 250 when my max up speed is 120

Grtzz

Ps sorry for the chrappy english (I'm dutch)

TMownsu
09-01-2007, 04:10
Probably has to do with how many connections the router can handle at any given time. DHT can help but it wont matter if the client/router can't connect to atleast 50-100 peers if there is that many in the swarm.

IMM22
31-01-2007, 10:20
Hi,

I keep getting the same error when trying to download torrent file.

"segmentation fault"

What's happening ? :confused:

Thanks !

qz3fwd
06-02-2007, 02:44
Here is are 2 dumb question:
1. Since enhanced ctorrent seems to be command line compatible with the asus ctorrent program, why not just replace the ctorrent executable in the custom firmware with your enhanced ctorrent version? That way the asus utilites should work together with the improved torrent client?

2. OR install enhanced ctorrent to the opt directory and change the name to ctorrent. That way if the system finds this ctorrent before the built in asus version it will use the fixed version without the file size limitation?

clausbruun
06-02-2007, 12:02
Here is are 2 dumb question:
1. Since enhanced ctorrent seems to be command line compatible with the asus ctorrent program, why not just replace the ctorrent executable in the custom firmware with your enhanced ctorrent version? That way the asus utilites should work together with the improved torrent client?

2. OR install enhanced ctorrent to the opt directory and change the name to ctorrent. That way if the system finds this ctorrent before the built in asus version it will use the fixed version without the file size limitation?

Sounds like a great idea! I prefer using the shell though.

luckynuts
14-02-2007, 23:51
When i open my torrent and stuff, everything works, but i ain´t getting any status or shit...actually i don´t even know if my enhanced torrent is downloading ^^ Kinda like that (the Screen): http://home.mnet-online.de/luckynuts/torrent.JPG

IMM22
17-02-2007, 12:57
Hi,

I keep getting the same error when trying to download torrent file.

"segmentation fault"

What's happening ?

Thanks !

GerardNL
18-02-2007, 11:06
When i open my torrent and stuff, everything works, but i ain´t getting any status or shit...actually i don´t even know if my enhanced torrent is downloading ^^ Kinda like that (the Screen): http://home.mnet-online.de/luckynuts/torrent.JPG

Sorry. I have not encountered that error message before yet. Maybe the webpages for the enhanced-ctorrent client will give you an answer on it?

luckynuts
20-02-2007, 13:57
hey guy´s i checkt on that error message a lot people get when they try to download stuff with ctorrent. I sent a email to one of the guy´s who made that programm. To get all the answeres they need to help us, I need the help of you guy´s who implemented that programm in the firmware. Here you go with the stuff they need:

Email:
> > hi,
> > i checked out your programm (enhanced ctorrent) well, when i tryed do
> download a file, i typed in like enhanced-ctorrent filname.torrent it shows
> me all of the file info, but no progress or stuff. on the very button it
> shows this message: "Segmentation fault" (i made a screenshot of it:
> http://home.mnet-online.de/luckynuts/torrent.JPG ) Why doesn?t it download or stuff?
> >
> ------------------------------------
> First, please verify that you're using release dnh2.2 (the first line
> of output when running ctorrent with no parameters will indicate the
> version); versions prior to dnh2 could not handle torrents over 4GB.
> Also let me know what parameters (options) you are using.
>
> Assuming you're on dnh2.2, we'll need to try to get some debugging
> information. Please insure that your ctorrent binary has not been
> "stripped"; a 'make install' or package installation may do this.
> The binary should be around 350K. If it is significantly smaller,
> recompile the program and copy "ctorrent" from the work directory
> rather than performing an install.
>
> When the problem happens, you should get a core dump; run a gdb
> backtrace on it, as follows. You'll likely need to specify the
> full path to ctorrent, and the path and name of the core file if
> not in the current directory.
> 1. $ gdb -se ctorrent -c *.core
> 2. (gdb) bt
> 3. (gdb) quit
>
> Please send me a copy of the output from the "bt" command (cut and
> paste is fine). Keep a copy of the ctorrent executable and the core
> file if possible in case some additional information is needed.
>
> +----------------+-----------------+----------------------------------+
> | Dennis Holmes |dholmes@rahul.net| "We demand rigidly defined areas |
> | San Jose, CA +-----------------+ of doubt and uncertainty!" |
> +----=>{ Meanwhile, as Ford said: "Where are my potato chips?" }<=----+

gratitude182
20-02-2007, 18:37
im not sure but do you start the torrent with "enhanced-ctorrent torrentfilename.torrent" instead of "ctorrent torrentfilename.torrent" ?

and is this error also with files < 2 gb?

grat182

luckynuts
20-02-2007, 20:22
yeah, the file i just now is like 89mb big. For each time i tried it, i used another one, though it can´t be because of the torrent file.
now i tried it with ctorrent filename.torrent and as you can see it doesn´t work at all:


[luckynuts@(none) Download]$ ctorrent weekend.torrent
-bash: ctorrent: command not found
[luckynuts@(none) Download]$ enhanced-ctorrent weekend.torrent
META INFO
Announce: http://tracker.bitreactor.to:2710/announce
Created On: Wed Feb 8 14:52:46 2006
Piece length: 262144

FILES INFO
<1> 2 Live Crew- Sports Weekend-for bitreactor.to.rar [94108484]
Total: 89 MB

Segmentation fault
[luckynuts@(none) Download]$

costa1001
21-02-2007, 13:02
just an idea (worth to try).


export LD_LIBRARY_PATH=/opt/lib

and try the ctorrent again

luckynuts
23-02-2007, 15:52
i typed that in and it didn´t show any affect...what is it suppose to do anyway?

costa1001
23-02-2007, 16:41
By default, the system looks for libs only in /lib and /usr/lib

If your packages are installed to /opt, then is good to 'tell' the system to look also in /opt/lib

I had few times when "Segmentation fault" was solved by this.

luckynuts
23-02-2007, 17:26
do i have to be in a certain folder to typ that in or something?

costa1001
26-02-2007, 10:53
no. you can run it from anywhere.

Denmike
04-03-2007, 10:28
Manually downgrade enhanced-ctorrent to enhanced-ctorrent_dnh2-3_mipsel.ipk. This version is working fine on wl700ge router.

IMM22
05-03-2007, 20:24
The downgrade work for me too. Thanks for de advise !!!

GerardNL
08-04-2007, 14:24
It's not very polite to post the same question on several groups on the same website.

Specially, since the answer is the same:

http://wl500g.info/showpost.php?p=51605&postcount=219

You will need to set the path everytime manually if you login as root. Which is explained somewhere in this thread: http://wl500g.info/showthread.php?t=7109

Fullback
10-04-2007, 22:10
Hey this bit torrent client works great for me it uploads, and downloads great i have tired 10 sites, with 4 download from different source. I Love it thanks for the great tutorial!!

LeperKing
12-05-2007, 00:14
Manually downgrade enhanced-ctorrent to enhanced-ctorrent_dnh2-3_mipsel.ipk. This version is working fine on wl700ge router.

I'm trying to do this at the moment. What is the actual command to downgrade enhanced-ctorrent?

Thanks,
LK

Denmike
12-05-2007, 07:22
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/enhanced-ctorrent_dnh2-3_mipsel.ipk

ipkg -force-downgrade install enhanced-ctorrent_dnh2-3_mipsel.ipk

LeperKing
12-05-2007, 13:23
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/enhanced-ctorrent_dnh2-3_mipsel.ipk

ipkg -force-downgrade install enhanced-ctorrent_dnh2-3_mipsel.ipk

Thanks, that did the trick. I just needed to to make sure I was in a folder that was writable before I performed the wget.:o

LK

Gizmo1007
24-10-2007, 20:38
Tks Guys,

3 hard days and nites and finally a bit torrent system working even if it's command line it's good to have it working.:rolleyes: