HTB not shaping correctly ? (or bad scripts...)

Linux Advanced Routing and Traffic Control

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

 



Hello to everybody,

We have an ADSL link with uplink speed of 530kbit, the goal is to divide the
traffic into three classes,
let say A, B and C.
A data rate of 240kbps must be guaratee to class A.
The remaing rate must be assigned: at least 180kbit to class B and at least
80kbit to class C.
The unused band of class A must be given to class B and C (if needed)
The unused band of class B must be given to C (if needed)
The unused band of class C must be given to B (if needed)

We started with the following HTB configuration:


#
DEV_RATE=530kbit
DEV_CEIL=530kbit

RT_RATE=240kbit
RT_CEIL=240kbit

MC_RATE=180kbit
MC_CEIL=530kbit

BE_RATE=80kbit
BE_CEIL=530kbit

OUTDEV=atm0
iptables -t mangle -F
iptables -F

tc qdisc del dev $OUTDEV root handle 1:
# Classification of A
iptables -t mangle -A PREROUTING -p udp --dport 50000 -j MARK --set-mark 100
iptables -t mangle -A PREROUTING -p udp --dport 50000 -j ACCEPT

# Classification of B
iptables -t mangle -A PREROUTING -p udp --dport 50001 -j MARK --set-mark 200
iptables -t mangle -A PREROUTING -p udp --dport 50001 -j ACCEPT

# Classification of C
iptables -t mangle -A PREROUTING -p udp --dport 50002 -j MARK --set-mark 300
iptables -t mangle -A PREROUTING -p udp --dport 50002 -j ACCEPT

# Definition of Class
tc qdisc add dev $OUTDEV root handle 1: htb default 30
tc class add dev $OUTDEV parent 1: classid 1:1 htb rate ${DEV_RATE} ceil
${DEV_CEIL} cburst 500kb

tc class add dev $OUTDEV parent 1:1 classid 1:10 htb rate ${RT_RATE} ceil
${RT_CEIL} prio 1
tc class add dev $OUTDEV parent 1:1 classid 1:20 htb rate ${MC_RATE} ceil
${MC_CEIL} prio 2
tc class add dev $OUTDEV parent 1:1 classid 1:30 htb rate ${BE_RATE} ceil
${BE_CEIL} prio 3

tc filter add dev $OUTDEV parent 1:0 protocol ip prio 1 handle 100 fw
classid 1:10 \
	police rate ${RT_RATE} burst 20kbit drop flowid 1:10

tc filter add dev $OUTDEV parent 1:0 protocol ip prio 2 handle 200 fw
classid 1:20
tc filter add dev $OUTDEV parent 1:0 protocol ip prio 3 handle 300 fw
classid 1:30

tc qdisc add dev $OUTDEV parent 1:10 handle 10: pfifo limit 10
tc qdisc add dev $OUTDEV parent 1:20 handle 20: pfifo limit 50
tc qdisc add dev $OUTDEV parent 1:30 handle 30: pfifo limit 30

Data are generated by a SmartBits. Packet size for class A is 60 byte.
Avarage packet size for class B is 250 and avarage packet size for C is 235.
In class B and C there are some packets of 1500 bytes.

Adsl MTU is 576.

Date are received from Ethernet interface and sent over adsl. The ADSL modem
is connected
via usb interface to the box. This does not introduce extra overhead.
On class A we sent exactly 240kbit or more and regardless data rate sent for
class B and C, on class A we never reach 240kbit stopping to 238kbit.

What is sent on class B and C is completely received.
To get exactly 240kbit on A, we must set RT_RATE to 290kbit, but of course
sendign more than 290kbit, we suck band to B and C. In this case we exceed
RT_RATE (again this sounds strange...)

With value between 240 and 290, we continue to stop to 238. Changing value
of RT_CEIL does not help and in any case we NEED to stop at 240kbit.

Do you have an explanation for this ? There are better way to use shaping
rules ?

Previously we tried:

tc class add dev $OUTDEV parent 1: classid 1:1 htb rate ${DEV_RATE} ceil
${DEV_CEIL}

obtaining same results in terms of data rate, but we got too much delay in
class B and C.

Increasing the value of limit for class A, we get more delay.
Using sfq does not help, as we loose many packets.

Any help will be appreciated...
Thanks
-- luciano lucrezia


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

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux