[LARTC] TC/CBQ shaping problems
Muthukumar S
muthukumar at gmail.com
Wed Jan 4 23:24:38 CET 2006
Hello everyone,
I'm a newbie experimenting with CBQ shaping and am facing a few problems.
Can any of you please help?
TEST SETUP:
+---------------+ +----------------+
| 10.0.0.103 |----------->| 10.0.0.102 |
+---------------+ +----------------+
10.0.0.103: Linux, 100Mbit/s NIC
10.0.0.102: Windows, 100Mbit/s NIC, iperf tcp server (ports 2000 and 2001)
WHAT I WANT TO DO:
1. Traffic from 10.0.0.103 to 10.0.0.102 port 2000 should always receive
at least 60Mbit/s regardless of presence of other traffic.
2. In the absence of traffic to 10.0.0.102 port 2000, all other traffic
should use all available bandwidth
CBQ SETUP 1:
#!/bin/bash
# rate1 = 60Mbit/s
RATE1=614400000
PRIO="prio 1"
DEV="dev eth0"
OPTION="allot 1514 maxburst 20 avpkt 1000"
# reset qdiscs
tc qdisc del $DEV root
# root CBQ
tc qdisc add $DEV root handle 10: cbq bandwidth 100mbit avpkt 1000
# 60 Mbit/s class
tc class add $DEV parent 10:0 classid 10:1 cbq bandwidth 100mbit rate
$RATE1 $OPTION $PRIO borrow
# add filter
tc filter add $DEV parent 10:0 protocol ip prio 3 handle 1 fw flowid 10:1
# mark packets
iptables -A OUTPUT -t mangle -p tcp --dport 2000 -d 10.0.0.102 -j MARK
--set-mark 1
OBSERVED RESULTS FOR SETUP 1:
1. A single iperf session to 10.0.0.102 port 2000 for 40 seconds reports
93.1 Mbit/s
2. Two simultaneous iperf sessions to 10.0.0.102 on ports 2000 and 2001
for 40 seconds each report 48.4 Mbit/s and 44.3 Mbit/s respectively
3. "tc -s -d class show dev eth0" shows the 10:1 class processing packets
and I assume port 2001 traffic uses the root qdisc. Is this assumption right?
CBQ SETUP 2:
I added a CBQ class 10:2 with a rate of 10240000, prio 3, borrow
parameter, a filter to direct port 2001 traffic to 10:2 and iptables
rules to assign fwmark.
OBSERVED RESULTS FOR SETUP 2:
Almost the same as above results with traffic being directed to
appropriate classes.
QUESTIONS:
1. What am I doing wrong? Why doesn't port 2000 traffic always receive
at least 60 Mbit/s?
2. prio 1 offers higher priority than prio 3, right? Lower the number,
higher the priority?
3. bandwidth parameter: I've seen examples where people always use the
NIC bandwidth (100 Mbit/s) and some examples where people use the link
bandwidth (say 6 Mbit/s for a DSL link). Which is right?
4. is it recommended that I have a class below the root CBQ and all
other classes as sub classes of that class?
Thanks!
Muthu
More information about the LARTC
mailing list