Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

Packet shaping and Bittorrent

Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2005, 01:13 PM
Default Packet shaping and Bittorrent



Hi I am a Debian box that acts as a file server and bittorrent client
behind a firewall. What I would like to do is limit the uploading of
torrents so that other services (SSH, HTTP etc) arent affected.

I have followed this tutorial:
http://gentoo-wiki.com/HOWTO_Packet_Shaping. I can do the tc qdisc
stuff fine, however I dont seem to be able to mark the packets
correctly.

Bittorrent is supposed to use accept requests for data on ports 6881 to
6889 (or sometimes 6881 to 6999). However the way that I understand it
is that I can push data out to the other person rather than them
pulling it. This gets around issues if one person has a firewall.

Now the problem with this is that linux will choose any port over 1024
for this pushing of data, how so can I classify it as torrent traffic?

For example whilst running a torrent this is part of the results of my
"netstat -pan"
tcp 0 0 10.0.0.5:2105 81.154.91.77:40897
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2940 129.44.123.136:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:4479 83.168.28.29:50000
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3831 221.25.68.4:55535
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3181 64.216.179.246:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2206 81.9.144.171:27610
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3533 24.160.210.155:59324
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2056 203.218.95.200:9413
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2396 24.17.167.98:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3810 216.59.248.26:49751
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:4122 65.26.252.242:10500
ESTABLISHED28743/python
tcp 0 34 10.0.0.5:3310 83.213.9.227:51679
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3421 70.30.162.196:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3013 84.153.211.216:16881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:4951 213.89.196.63:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3900 202.9.62.247:52999
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3489 66.92.1.188:6884
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3158 217.155.187.86:6881
ESTABLISHED27984/python
tcp 0 9 10.0.0.5:2993 82.68.134.142:4008
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2863 165.123.189.171:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2622 72.136.199.141:54651
ESTABLISHED28743/python
tcp 0 9 10.0.0.5:4542 67.160.44.249:7343
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:4420 83.155.4.156:6181
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3513 172.172.163.76:13605
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:4507 85.220.113.174:6981
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2584 172.188.130.199:11768
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2273 203.59.118.144:65222
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:4474 87.123.1.125:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2530 24.155.40.189:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3225 195.137.76.66:24213
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:4543 172.188.101.75:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2587 84.174.100.206:41596
ESTABLISHED28743/python
tcp 0 54 10.0.0.5:3075 85.168.38.158:6346
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3782 65.94.47.52:52397
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2069 172.210.85.46:3767
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2486 172.216.28.154:6881
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2294 82.233.154.155:12174
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:3697 212.194.47.28:15237
ESTABLISHED28743/python
tcp 0 0 10.0.0.5:2480 168.226.230.126:60001
ESTABLISHED28743/python


as you can see the outgoing ports could be anything! so how can I limit
them if I dont know what port it will use?

Thanks
Kevin



Kevin
Reply With Quote
  #2  
Old 12-02-2005, 06:22 PM
Steve Horsley
Guest
 
Posts: n/a
Default Re: Packet shaping and Bittorrent

Kevin wrote:
> Hi I am a Debian box that acts as a file server and bittorrent client
> behind a firewall. What I would like to do is limit the uploading of
> torrents so that other services (SSH, HTTP etc) arent affected.
>
> I have followed this tutorial:
> http://gentoo-wiki.com/HOWTO_Packet_Shaping. I can do the tc qdisc
> stuff fine, however I dont seem to be able to mark the packets
> correctly.
>
> Bittorrent is supposed to use accept requests for data on ports 6881 to
> 6889 (or sometimes 6881 to 6999). However the way that I understand it
> is that I can push data out to the other person rather than them
> pulling it. This gets around issues if one person has a firewall.
>
> Now the problem with this is that linux will choose any port over 1024
> for this pushing of data, how so can I classify it as torrent traffic?


You are right - with that scattering of port numbers, you have no
chance. Can I suggest that you try the Azureus client? It has a
fine set of options, including limiting both upload and download
throughput limits which can be changed on the fly.

Steve
Reply With Quote
  #3  
Old 12-05-2005, 08:23 AM
Eric Moors
Guest
 
Posts: n/a
Default Re: Packet shaping and Bittorrent


> Hi I am a Debian box that acts as a file server and bittorrent client
> behind a firewall. What I would like to do is limit the uploading of
> torrents so that other services (SSH, HTTP etc) arent affected.
>
> I have followed this tutorial:
> http://gentoo-wiki.com/HOWTO_Packet_Shaping. I can do the tc qdisc
> stuff fine, however I dont seem to be able to mark the packets
> correctly.
>
> Bittorrent is supposed to use accept requests for data on ports 6881 to
> 6889 (or sometimes 6881 to 6999). However the way that I understand it
> is that I can push data out to the other person rather than them
> pulling it. This gets around issues if one person has a firewall.
>
> Now the problem with this is that linux will choose any port over 1024
> for this pushing of data, how so can I classify it as torrent traffic?
>


Use the proper matching modules:
The howto mentions both

http://ipp2p.org/
http://l7-filter.sourceforge.net/

> as you can see the outgoing ports could be anything! so how can I limit
> them if I dont know what port it will use?


By using the modules those projects provide.
They attempt to classify packets based on their content.
As a side-note: I have not used these, but I can imagine they will
take up a lot of resources though.

Eric
Reply With Quote
  #4  
Old 12-06-2005, 11:22 AM
Kevin
Guest
 
Posts: n/a
Default Re: Packet shaping and Bittorrent

Thanks for your replies guys.
Steve: I am moving away from Azureus to a dedicated linux box! You are
right though.... If only it worked with a bit less ram and without the
GUI.
Eric: I did try to get ipp2p to work but was unsuccessful. Also as
you say, there could be performance issues. I am a bit surprised that
he doesnt mention this in the article.

I think what I am going to have to do is just set all traffic that
occurs on ports >1024 as torrent traffic. The only important ports for
me are ssh, http and samba, and they all occur on known ports.
Cheers
Kevin

Reply With Quote
Reply

Tags
bittorrent, packet, shaping

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 12:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.