Download ratio unstable
Hi, i'm newbie with traffic control. I create a script based in one from Jason Boxman (thx a lot). the upload flow is prioritized well, but when i download from a site, the down flow vary a lot from 25 KB to 4 KB. Before i use this script the downloads are constant between 22 an 25 KB. Perhaps there's something wrong in my script ?
I paste it, thx.
---------------------------------------------------------------------
#!/bin/bash
RATE0
LOCALIF=eth1
clear_all() {
tc qdisc del dev $LOCALIF root >/dev/null 2>&1 iptables -t mangle -F
}
create_tree() {
tc qdisc add dev $LOCALIF root handle 1: htb default 1 tc class add dev $LOCALIF parent 1: classid 1:1 htb rate
${RATE}kbit ceil ${RATE}kbit
tc qdisc add dev $LOCALIF parent 1:1 handle 2: prio bands 4 tc qdisc add dev $LOCALIF parent 2:1 handle 10: sfq perturb 20 tc qdisc add dev $LOCALIF parent 2:2 handle 20: sfq perturb 20 tc qdisc add dev $LOCALIF parent 2:3 handle 30: sfq perturb 20 tc qdisc add dev $LOCALIF parent 2:4 handle 40: tbf rate
$(($RATE-40))kbit burst 1600 limit 3000
}
create_filters() {
# Match SYN and RST packets
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp -m tcp
--tcp-flags ! SYN,RST,ACK ACK -j CLASSIFY --set-class 2:1
# Match ACK packets
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp -m tcp
--tcp-flags SYN,RST,ACK ACK -m length --length :128 -m tos ! --tos Normal-Service -j CLASSIFY --set-class 2:1
# Match packets with TOS Minimize-Delay
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp -m tos --tos
Minimize-Delay -j CLASSIFY --set-class 2:2
# ICMP
iptables -t mangle -A POSTROUTING -o $LOCALIF -p icmp -j CLASSIFY
--set-class 2:1
# HTTP
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --dport 80 -jCLASSIFY --set-class 2:2
# IRC
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --dport 6667-j CLASSIFY --set-class 2:2
# SSH
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --dport 22 -j
CLASSIFY --set-class 2:2
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --sport 22 -jCLASSIFY --set-class 2:2
iptables -t mangle -A POSTROUTING -p tcp -m tos --tos
Maximize-Throughput --sport ssh -j CLASSIFY --set-class 2:3
iptables -t mangle -A POSTROUTING -p tcp -m tos --tosMaximize-Throughput --dport ssh -j CLASSIFY --set-class 2:3
# Matches for Edonkey and Overnet
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --dport
4662:4672 -j CLASSIFY --set-class 2:4
iptables -t mangle -A POSTROUTING -o $LOCALIF -p udp --dport
4662:4672 -j CLASSIFY --set-class 2:4
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --sport
4662:4672 -j CLASSIFY --set-class 2:4
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --sport4662:4672 -j CLASSIFY --set-class 2:4
# FTP
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --dport 21 -j
CLASSIFY --set-class 2:3
iptables -t mangle -A POSTROUTING -o $LOCALIF -p tcp --sport 21 -jCLASSIFY --set-class 2:3
}
case $1 in
'start')
echo 'Creando la estructura qdisc ...'
clear_all
create_tree
create_filters
;;
'stop')
echo 'Eliminando la estructura qdisc ...'
clear_all
;;esac
-------------------------------------------------------------------
That's all. Thanks in advance.
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/