mldonkey-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-users] FreeBSD ipfw2/dummynet traffic shaping


From: nospam
Subject: [Mldonkey-users] FreeBSD ipfw2/dummynet traffic shaping
Date: Wed, 29 Jan 2003 10:47:16 +0100
User-agent: Mutt/1.2.5i

I wrote some rules using dummynet and ipfw2 (with 4.x-STABLE you need to 
define it in your kernelconfig) to shape mldonkey traffic in a sane way.

It's designed for a DSL line with outgoing speed 128kbit, maintaining 
quick interactive response times while mldonkey is clogging your upstream ;)

Hope this helps.

# v1.0
# comments:
# outgoing interface for DSL is tun0 
# mldonkey UID is 2003
#
# overall bandwidth, a bit slower than 128 to prevent filling of modem buffers

ipfw pipe 1 config bw 125kbit/s queue 10 

# normal queue, high weight, each connection gets its own flow

ipfw queue 10 config queue 16kByte weight 100 pipe 1 mask all

# queue for mldonkey, low weight, using GRED if too much traffic for 
# dropping packets to slow down TCP connections (see man(8) ipfw)

ipfw queue 11 config queue 24kByte weight 1 pipe 1 gred 0.02/3/6/0.06

# separate queue for udp, low weight, big enough to not overflow the queue

ipfw queue 12 config queue 16kByte weight 1 pipe 1 

# short tcp packets get high weight (ack, syn....)
# not only length 40 but higher because of tcp rfc options

ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 40 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 41 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 42 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 43 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 44 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 45 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 46 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 47 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 48 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 49 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 50 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 51 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 52 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 53 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 55 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 55 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 56 
ipfw add 30 queue 10 tcp from any to any out via tun0 iplen 57 

# we want quick interactive response

ipfw add 32 queue 10 tcp from any to any 22 out via tun0 

# mldonkey udp into queue 12

ipfw add 34 queue 12 udp from any to any out via tun0 uid 2003

# other udp (e.g. DNS, NTP) high weight

ipfw add 34 queue 10 udp from any to any out via tun0

# mldonkey chunk requests etc. low weight, mldonkey uid is 2003

ipfw add 34 queue 11 tcp from any to any out via tun0 uid 2003

# everything not matched before high weight

ipfw add 34 queue 10 ip from any to any out via tun0


to see how the queues work you can add the following lines (just an
example, chose two different nearby hosts with a low ping)

ipfw add 31 queue 10 icmp from any to www.google.com out via tun0
ipfw add 31 queue 11 icmp from any to www.yahoo.com out via tun0 

now pings to those hosts differ under (too) high load, you should experience 
packet drops and slower response on queue 11, but none on queue 10.

The commands

ipfw queue l 
and 
ipfw show

are quite helpful to observe traffic. You can tune GRED parameters, too,
but they're quite complex. See http://www.icir.org/floyd/red.html for
documentation.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]