This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KTorrent, NAT and slow downloads

Tags: None
(comma "," separated)
C-MoH
Registered Member
Posts
6
Karma
0
OS

KTorrent, NAT and slow downloads

Tue Feb 07, 2006 12:55 am
Hello.

I've turned to the bittorrent protocol quite lately, so I'm not accustomed to what a usual speed would be, how other clients behave, what exactly trackers are etc.

However, my pipe can handle 100kB/s (ie. kilobytes) while ktorrent usually downloads at 2-5kB/s average speed with spikes to 30kB/s from time to time. Some torrents do come at 40kB/s (well, I've decided to post since this is the second and... I saw on the forums it's a pretty common problem)

First question is... is this related to the torrent or with the client?

Second issue I've seen it's with the NAT/firewall. I've forwarded the TCP port correctly, however the UDP port forward does not process data. I can see this through the iptables stats. netstat -an | grep 4444 shows no socket listening on udp port 4444 on the client. Is this to be expected? iptraf shows no UDP traffic on port 4444 on the firewall. Should it?

Third issue... I'm not sure if I forwarded the UDP port correctly, and I haven't found a good way of testing it yet, except to monitor stats and packets. Also I'm not planning to use UPNP... maybe a manual NAT/firewall configuration technique should be present in the FAQ (a suggestion I hope you will consider)

I saw some things in another forum about watching the log, and I do get Authentication(S) in it.

Here are the relevant iptables configuration lines (based on http://www.tldp.org/HOWTO/IP-Masquerade ... index.html):
Code: Select all
#### KTorrent

$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -p tcp --dport 6881 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -p udp --dport 4444 -j ACCEPT

$IPTABLES -A PREROUTING -t nat -p tcp -d $EXTIP --dport 6881 -j DNAT --to $PORTFWIP:6881
$IPTABLES -A PREROUTING -t nat -p udp -d $EXTIP --dport 4444 -j DNAT --to $PORTFWIP:4444


And the iptables stats:
Code: Select all
pinky masq-config # iptables -v -L -n
[...]
Chain FORWARD (policy DROP 2 packets, 324 bytes)
 pkts bytes target     prot opt in     out     source               destination
85380   70M ACCEPT     tcp  --  eth1   eth0    0.0.0.0/0            0.0.0.0/0           tcp dpt:6881 state NEW,RELATED,ESTABLISHED
    0     0 ACCEPT     udp  --  eth1   eth0    0.0.0.0/0            0.0.0.0/0           udp dpt:4444
85555   35M ACCEPT     all  --  eth1   eth0    0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
 174K   60M ACCEPT-LOG  all  --  eth0   eth1    0.0.0.0/0            0.0.0.0/0
   36  2160 DROP-LOG   all  --  *      *       0.0.0.0/0            0.0.0.0/0
[...]
pinky masq-config # iptables -v -L -n -t nat
Chain PREROUTING (policy ACCEPT 208M packets, 21G bytes)
 pkts bytes target     prot opt in     out     source               destination
 1047 51360 DNAT       tcp  --  *      *       0.0.0.0/0            82.77.156.206       tcp dpt:6881 to:192.168.0.2:6881
    0     0 DNAT       udp  --  *      *       0.0.0.0/0            82.77.156.206       udp dpt:4444 to:192.168.0.2:4444


Oh and... I'm using KTorrent 1.2rc2 and now 1.2 on 2.6.14-gentoo-r5 x86_64 AMD Athlon(tm) 64 Processor, and the NAT is 2.6.7-hardened-r8 i686 Pentium II.
George
Moderator
Posts
5421
Karma
1
C-MoH wrote:Hello.

I've turned to the bittorrent protocol quite lately, so I'm not accustomed to what a usual speed would be, how other clients behave, what exactly trackers are etc.

However, my pipe can handle 100kB/s (ie. kilobytes) while ktorrent usually downloads at 2-5kB/s average speed with spikes to 30kB/s from time to time. Some torrents do come at 40kB/s (well, I've decided to post since this is the second and... I saw on the forums it's a pretty common problem)

First question is... is this related to the torrent or with the client?


Most speed problems should be gone with 1.2 final.

Second issue I've seen it's with the NAT/firewall. I've forwarded the TCP port correctly, however the UDP port forward does not process data. I can see this through the iptables stats. netstat -an | grep 4444 shows no socket listening on udp port 4444 on the client. Is this to be expected? iptraf shows no UDP traffic on port 4444 on the firewall. Should it?


Most trackers use HTTP, but there are trackers which use UDP. And this port is for those, but it is only used when you have a torrent with udp trackers, which is not that common. So most off the time you will not need this port.

Third issue... I'm not sure if I forwarded the UDP port correctly, and I haven't found a good way of testing it yet, except to monitor stats and packets. Also I'm not planning to use UPNP... maybe a manual NAT/firewall configuration technique should be present in the FAQ (a suggestion I hope you will consider)

We could add this to the FAQ,

I saw some things in another forum about watching the log, and I do get Authentication(S) in it.


That's good, you get incoming connections, so I guess we can add this to the FAQ. I will update it later this evening.
C-MoH
Registered Member
Posts
6
Karma
0
OS

Wed Feb 08, 2006 7:00 pm
Heh... here I was asking if my configuration is correct, and I find it good enough for the faq :) Just kidding.

Still, I'd like to know if the UDP port forwarding is working. Do you know a torrent using an UDP tracker?

I also found this link to be helpful: http://azureus.aelitis.com/wiki/index.php/Firewalling#Configuring_Iptables_.28Linux.29
imported4-Ivan
Registered Member
Posts
819
Karma
0

Wed Feb 08, 2006 7:14 pm
You can try registering on www.demonoid.com they have both HTTP and UDP torrent.
George
Moderator
Posts
5421
Karma
1

Thu Feb 09, 2006 5:40 pm
I seem to remember niteshadow using UDP trackers, try looking for torrents of Enterprise (The last Star Trek series)
broli
Registered Member
Posts
17
Karma
0

Sun Mar 05, 2006 7:51 pm
stupid question...
ktorrent uses only one port ? like azureus ? or uses a range beginig with the one I used in the config ?


-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d++ s+:++ a-- C+++ UL++++ P+ L++ E-- W++ N o-- K- w---
O- M- V- PS+ PE-- Y+ PGP t+ 5 X R tv+ b++ DI++ D++
G e h! r-- y
------END GEEK CODE BLOCK------
imported4-Ivan
Registered Member
Posts
819
Karma
0

Sun Mar 05, 2006 8:26 pm
KTorrent uses one port - the one you specified in settings dialog.
If that port is not available KT will then try to use the first available port starting from the one you specified.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]