All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edgar <donvodka@gmail.com>
To: lartc@vger.kernel.org
Subject: [LARTC] Help with traffic control (HTB ESFQ RED)
Date: Mon, 09 Jul 2007 19:14:00 +0000	[thread overview]
Message-ID: <469288F8.7060409@gmail.com> (raw)

Hello, there's a problem I've had for several months now, and I've never 
been able to find an answer to it. I'll try to explain as quick as possible:

    I have a server that controlls my home network, it provides internet 
to them also (NAT) and I would like to provide QoS by shaping traffic. I 
have a p2p server here (running mldonkey), since only that machine is 
serving p2p and anyone can connect to it to download linux distros ( :) 
) my attemp here was to limit bandwidth for that machine. I've partially 
done this, I've written some HTB rules and I've nested ESFQ leafs within 
htb classes. At first it seems like it works, but then two problems 
arise: 1) Web latency (partially solved by increasing burst size, but 
still happens) and 2) download seems affected a lot in the p2p server.
   
    I believe HTB is doing it's work, but the one that is failing to do 
so correctly is ESFQ, since I see upload limitted to the rate I specify. 
I'm using ESFQ since it can control traffic by ip, instead of doing it 
by flows (like classic sfq). I tried using RED too, but I haven't been 
able to find much documentation for it, so I guess I might be doing RED 
stuff wrong (I'll include my RED rule too, in case anyone can help with 
it). So I'll post the script I'm using to shape traffic, hope you ppl 
can help me out.

#!/bin/sh

### Upload Link ###
DEV=eth0

### Modify $DEV's queue and MTU ###
ip link set dev $DEV qlen 50
ip link set dev $DEV mtu 1500

### iptables mangle table cleanup ###
iptables -t mangle -F
iptables -t mangle -X

## ROOT QDISC cleanup in $DEV
tc qdisc del dev $DEV root 2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
#tc qdisc del dev $HDEV root 2> /dev/null > /dev/null

P2P_IP\x192.168.0.100
SSH_PORTê00

### CLASSES ###
SSH=1:10
P2P=1:20
DEF=1:30
HTTP=1:40

iptables -t mangle -A POSTROUTING -s $P2P_IP -o $DEV -j CLASSIFY 
--set-class $P2P
iptables -t mangle -A OUTPUT -o $DEV -p tcp --sport $SSH_PORT -j MARK 
--set-mark 1
iptables -t mangle -A POSTROUTING -o $DEV -s ! $P2P_IP -p tcp -m length 
--length :64 -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -o $DEV -m mark --mark 1 -j CLASSIFY 
--set-class $SSH
iptables -t mangle -A OUTPUT -o $DEV -m mark --mark 1 -j TOS --set-tos 
Minimize-Delay
iptables -t mangle -A POSTROUTING -o $DEV -s ! $P2P_IP -p tcp -m 
multiport --destination-ports 80,445,7777,7778,8080 -j MARK --set-mark 2
iptables -t mangle -A POSTROUTING -o $DEV -m mark --mark 2 -j CLASSIFY 
--set-class $HTTP
iptables -t mangle -A POSTROUTING -o $DEV -m mark --mark 2 -j TOS 
--set-tos Maximize-Throughput

MAX_RATE0kbps
P2P_UP\x10kbps
## HTB CLASSES ##

tc qdisc add dev $DEV root handle 1: htb default 30
tc class add dev $DEV parent 1: classid 1:1 htb rate $MAX_RATE burst 15k 
tc class add dev $DEV parent 1:1 classid $P2P htb rate 3kbps ceil 
$P2P_UP burst 0 prio 2 quantum 1600
tc class add dev $DEV parent 1:1 classid $SSH htb rate 5kbps ceil 
$MAX_RATE burst 0 prio 0 quantum 1600
tc class add dev $DEV parent 1:1 classid $HTTP htb rate 10kbps ceil 
$MAX_RATE burst 15k prio 0 quantum 1600
tc class add dev $DEV parent 1:1 classid $DEF htb rate 5kbps ceil 
$MAX_RATE burst 0 prio 1 quantum 1600

### ESFQ LEAFS ###
tc qdisc add dev $DEV parent $SSH handle 10: esfq perturb 10 hash ctorigdst
tc qdisc add dev $DEV parent $DEF handle 30: esfq perturb 10 hash classic
tc qdisc add dev $DEV parent $P2P handle 20: esfq perturb 10 hash 
ctorigdst depth 256
tc qdisc add dev $DEV parent $HTTP handle 40: esfq perturb 10 hash classic


## RED rule used instead of ESFQ one for $P2P class ##
#tc qdisc add dev $DEV parent $P2P handle 20: red min 1600 max 6400 
burst 5 limit 6k avpkt 1000



_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

             reply	other threads:[~2007-07-09 19:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09 19:14 Edgar [this message]
2007-07-17  2:06 ` [LARTC] Help with traffic control (HTB ESFQ RED) Andy Furniss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=469288F8.7060409@gmail.com \
    --to=donvodka@gmail.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.