Search This Blog

Monday, July 26, 2010

Re: controlling p2p & bittorrent

begin:vcard
fn:Maloteaux Alexandre
n:Alexandre;Maloteaux
org:Semlex
email;internet:am@semlex.net
tel;cell:0024107010210
version:2.1
end:vcard

Hi ,

This is a nice shapping . However , remember that all the traffic in
"others" will suffer from p2p traffic
It is better (i think) to mark (mangle) bittorrent connection and give
him a small priority.
This is very usefull if you are using a lot of different protocol(
rdesktop , irc , .........) because it prevens you to write a QOS rule
for each protocol .

As you don't know the tcp port that will be used , one solution that i
found in a mag is to mangle you packet based on the user id.
For exemple :

-create user "torrentuser" that will have id yyyy for exemple and all
the necessary right to use bittorrent
-sudo -u torrentuser /usr/bin/yourtorrentclient
-iptable -t mangle -A OUTPUT -o eth0 -p tcp --tcp-flags SYN SYN -m owner
--uid-owner yyyy -j CONNMARK --set-mark 98 #99 could be default
-Then add your tc filter with something like
tc class add dev eth0 parent 1:1 classid 1:98 htb rate 50kbit ceil
512kbit burst 2k prio xxx
tc qdisk add dev eth0 parent 1:98 handle 198: sfq perturb 10
tc filter add dev eth0 parent 1:0 protocol ip prio yyy handle 98 fw
flowid 1:98

Regards

On 07/25/2010 07:56 PM, Max wrote:
> wondershaper quite well solves this problem.
>
> 25.07.2010 19:32, Tim Clewlow пишет:
>>
>>> Does anyone have a shaping setup that tries to be fair where p2p is
>>> concerned,
>>> with miminal/no ingress shaping?
>>>
>>> Thanks.
>>>
>> .
>>
>> I use priority base queuing on outgoing connections. dont use any
>> kind of bandwidth limiting on incoming as I dont see how that would
>> really do anything. I use pf as my firewall on a bsd box, but the
>> proiritisations would be the same for any firewall. It works for me,
>> I used to have a similar problem with p2p hogging all the outgoing
>> bandwidth, now I dont, and p2p still runs fine.
>>
>> The following is taken from my firewall rules, the higher numbered
>> priorities *always* get put ahead of lower priorities.
>>
>> queue ssh on $ext_if priority 15 priq
>> queue dns on $ext_if priority 10 priq
>> queue http on $ext_if priority 5 priq
>> queue other on $ext_if priority 3 priq
>> queue hogs on $ext_if priority 1 priq (default)
>>
>> First priority goes to ssh, I rarely use it, but I want it first for
>> admin purposes. The dns queue is next highest, it is just for dns
>> queries (out via port 53) and nothing else, next the http queue is
>> for port 80 and 443 so both outgoing http and https traffic is
>> covered, finally the other queue is for everything else.
>> Additionally, there is a hogs queue that certain LAN IPs get put
>> into if they have really been testing my patience :-)
>>
>> Anyway, that arrangement means web browsing always gets put before
>> p2p traffic, ie only bandwidth left after ssh/dns/http/https is
>> available for p2p or other traffic of any kind.
>>
>> HTH, Tim.
>>
>>
>>
>>
>

--
-------------------------
Ingénieur industriel
Semlex Gabon S.A.
Gsm : +241.070.102.10
Web : www.semlex.com
-------------------------

No comments: