View Single Post

  #1 (permalink)  
Old 12-02-2005
Kevin
 
Posts: n/a
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

Reply With Quote