Hi
okay
#!/bin/bash
#
# Script to test TC
IF=${IF:-''eth0''}
SPEED=64
#
# 327b for 256 kbits (1K)
# 131K burst for 100Mb/s
# 12K burst for 10Mb/s
# pipe size /100 /8
BURST=163
BURST=$[$SPEED*1024/100/8]
MTU=1600
MTU=1500
TC=''/sbin/tc''
TC=''/usr/local/bin/tc''
tc_start2(){
# install root HTB, point default traffic to 1:20
tc qdisc add dev $IF root handle 1: htb default 20
# shape everything at $SPEED speed - this prevents huge queues in your
# DSL modem which destroy latency:
tc class add dev $IF parent 1: classid 1:1 htb rate ${SPEED}kbit ceil
${SPEED}kbit burst ${BURST}b mtu $MTU
# high prio class 1:10:
tc class add dev $IF parent 1:1 classid 1:10 htb rate $[9*${SPEED}/10]kbit ceil
${SPEED}kbit burst ${BURST}b prio 1 mtu $MTU quantum 8
# bulk & default class 1:20 - gets slightly less traffic,
# and a lower priority:
tc class add dev $IF parent 1:1 classid 1:20 htb rate $[5*${SPEED}/10]kbit ceil
$[9*${SPEED}/10]kbit burst $[10*${BURST}/10]b cburst $[9*${BURST}/10]b prio 2
mtu $MTU quantum 8
# for BTTorrent
tc class add dev $IF parent 1:1 classid 1:30 htb rate $[4*${SPEED}/10]kbit ceil
$[8*${SPEED}/10]kbit burst $[8*${BURST}/10]b cburst $[6*${BURST}/10]b prio 3
mtu $MTU quantum 8
# Filters
# both get Stochastic Fairness:
tc qdisc add dev $IF parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $IF parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $IF parent 1:30 handle 30: sfq perturb 10
# TOS Minimum Delay (ssh, NOT scp) in 1:10:
tc filter add dev $IF parent 1: protocol ip prio 10 u32 \
match ip tos 0x10 0xff \
flowid 1:10
# ICMP (ip protocol 1) in the interactive class 1:10 so we
# can do measurements & impress our friends:
tc filter add dev $IF parent 1: protocol ip prio 10 u32 \
match ip protocol 1 0xff \
flowid 1:10
# To speed up downloads while an upload is going on, put ACK packets in
# the interactive class:
tc filter add dev $IF parent 1: protocol ip pref 1 u32 \
match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:10
# limit BTTorent to flow :30
# want to match all packets that have a source of 6880-6888
# as I can only match/rate limit out going
tc filter add dev $IF parent 1: protocol ip prio 10 u32 \
match ip protocol 6 0xff \
match ip sport 6880 0xfff0 \
flowid 1:30
# match u16 0x1ae0 0xfff0 at 20 \
# Match firewall marks
tc filter add dev $IF parent 1: protocol ip pref 5 handle 4 fw flowid 1:30
# # For pings !
# tc filter add dev eth0 parent 1: protocol ip prio 100 u32 match ip protocol 1
0xFF flowid 1:10
# rest is ''non-interactive'' ie ''bulk'' and
ends up in 1:20
}
tc_start(){
tc_start2
}
tc_stop(){
$TC qdisc del dev $IF root
}
tc_show(){
$TC -s -d qdisc show dev $IF
$TC -s -d class show dev $IF
$TC -s -d filter show dev $IF
}
case "$1" in
start)
tc_start
;;
stop)
tc_stop
;;
restart)
tc_stop
tc_start
;;
show)
tc_show
;;
*)
tc_show
#exit 1
;;
esac
exit 0
Thanks
On Thu, Oct 21, 2004 at 09:18:29PM +0200, Stef Coene
wrote:> On Thursday 21 October 2004 11:59, Alexander Samad wrote:
> > class htb 1:30 parent 1:1 leaf 30: prio 3 quantum 8 rate 25Kbit ceil
> > 51Kbit burst 63b/8 mpu 0b overhead 0b cburst 47b/8 mpu 0b overhead 0b
> > level 0
> > Sent 495316458 bytes 541852 pkts (dropped 9303, overlimits 0 requeues
> > 0)
> >
> > >>> THIS is the line I have problems understanding
> > >>> I read it as 6190bit/sec which seems to be way lower than
the 25Kbit
> > >>> set for the rate and much lower than the ceil
> > >>> so why do I have a backlog
> >
> > rate 6190bit 7pps backlog 46p
> > lended: 220159 borrowed: 321647 giants: 0
> > tokens: -493609 ctokens: -242500
> >
> >
> > Having said all that it does seem to be limiting to 25Kbit, with burst
> > upto 51 !
> Can you post the executed tc commands? Much easier for us to see what you
> did.
>
> Stef
>
> --
> stef.coene@docum.org
> ?"Using Linux as bandwidth manager"
> ? ? ?http://www.docum.org/
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>