<html><div style='background-color:'><DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Hi Andy.</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Thanks !! Thanks a lot for your help !!!!<BR></FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Finally I'm seeing something working in the right way... ;)</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">I’ve tried another sender/receiver program (I find the “netperf” a little difficult to operate), so I’ve tried with </FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">“iperf”.<BR></FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Now I’m getting all the flows with the correct limitation for its corresponding class.<BR></FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">But also now, I’m getting ONLY the RATE limitation, not the CEIL one !!! :(<BR></FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">I’ve done a smaller test configuration, with the same 2 PCs, connected the same way and added the following rules:<BR>======================================================<BR>#interface="eth0"<BR>#interface="lo"<BR>interface="ppp0"</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">#Delete any previous stored configuration<BR>tc qdisc del dev $interface root</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">#Creating the root Qdisc (Queueing Disk)<BR>tc qdisc add dev $interface root handle 1: htb default 20</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">#Definition of classes<BR>tc class add dev $interface parent 1: classid 1:1 htb rate 28kbit ceil 28kbit<BR>tc class add dev $interface parent 1:2 classid 1:20 htb rate 10kbit ceil 28kbit prio 0<BR>tc class add dev $interface parent 1:3 classid 1:30 htb rate 15kbit ceil 28kbit prio 1</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">tc qdisc add dev $interface parent 1:20 handle 30: sfq<BR>tc qdisc add dev $interface parent 1:30 handle 40: sfq</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">#Definition of the filters<BR>tc filter add dev $interface protocol ip parent 1:0 u32 match ip dport 20001 0xffff flowid 1:20<BR>tc filter add dev $interface protocol ip parent 1:0 u32 match ip dport 20002 0xffff flowid 1:30<BR>==========================================================</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">This is my actual version of HTB:<BR></DIV></FONT>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">==========================================================<BR> [root@EdenRH9 htb]# tc qdisc add htb help<BR>What is "help"?<BR>Usage: ... qdisc add ... htb [default N] [r2q N]<BR> default minor id of class to which unclassified packets are sent {0}<BR> r2q DRR quantums are computed as rate in Bps/r2q {10}<BR> debug string of 16 numbers each 0-3 {0}</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]<BR> [ceil R2] [cburst B2] [mtu MTU] [quantum Q]<BR> rate rate allocated to this class (class can still borrow)<BR> burst max bytes burst which can be accumulated during idle period {computed}<BR> ceil definite upper class rate (no borrows) {rate}<BR> cburst burst but for ceil {computed}<BR> mtu max packet size we create rate map for {1600}<BR> prio priority of leaf; lower are served first {0}<BR> quantum how much bytes to serve from leaf at once {use r2q}</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">TC HTB version 3.3<BR>[root@EdenRH9 htb]#<BR>==========================================================</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">When I did a test run with the traffic generator Iperf, utilizing the following command I got the following results:<BR></FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">==========================================================<BR>[root@EdenRH9 htb]# iperf -c 192.168.7.100 -p 20001 -n 1 -l 50000<BR>------------------------------------------------------------<BR>Client connecting to 192.168.7.100, TCP port 20001<BR>TCP window size: 16.0 KByte (default)<BR>------------------------------------------------------------<BR>[ 3] local 192.168.7.200 port 35550 connected with 192.168.7.100 port 20001<BR>[ ID] Interval Transfer Bandwidth<BR>[ 3] 0.0-37.4 sec 48.8 KBytes 10.7 Kbits/sec<BR>[root@EdenRH9 htb]#<BR>==========================================================</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">You can already see that the rate didn’t went up to the 28kbit, and there was no other traffic on that interface or other class.<BR>So I’ve printed the output of the TC command regarding its QDISC, CLASS and FILTER, before the test run and after the test run and got the following answers:<BR></FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">==========================================================<BR> [root@EdenRH9 htb]# tc -s -d class show dev ppp0<BR>class htb 1:1 root prio 0 quantum 1000 rate 28Kbit ceil 28Kbit burst 1634b/8 mpu 0b cburst 1634b/8 mpu 0b level 0<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 373714 ctokens: 373714</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">class htb 1:20 root leaf 30: prio 0 quantum 1000 rate 10Kbit ceil 28Kbit burst 1611b/8 mpu 0b cburst 1634b/8 mpu 0b level 0<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 1031680 ctokens: 373714</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">class htb 1:30 root leaf 40: prio 1 quantum 1000 rate 15Kbit ceil 28Kbit burst 1618b/8 mpu 0b cburst 1634b/8 mpu 0b level 0<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 690773 ctokens: 373714</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">[root@EdenRH9 htb]# tc -s -d filter show dev ppp0<BR>filter parent 1: protocol ip pref 49151 u32<BR>filter parent 1: protocol ip pref 49151 u32 fh 801: ht divisor 1<BR>filter parent 1: protocol ip pref 49151 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:30<BR> match 00004e22/0000ffff at 20<BR>filter parent 1: protocol ip pref 49151 u32 fh 800: ht divisor 1<BR>filter parent 1: protocol ip pref 49151 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:20<BR> match 00004e21/0000ffff at 20<BR>filter parent 1: protocol ip pref 49152 u32<BR>filter parent 1: protocol ip pref 49152 u32 fh 801: ht divisor 1<BR>filter parent 1: protocol ip pref 49152 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:30<BR> match 00004e22/0000ffff at 20<BR>filter parent 1: protocol ip pref 49152 u32 fh 800: ht
divisor 1<BR>filter parent 1: protocol ip pref 49152 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:20<BR> match 00004e21/0000ffff at 20<BR>[root@EdenRH9 htb]# tc -s -d qdisc show dev ppp0<BR>qdisc sfq 40: quantum 1500b limit 128p flows 128/1024<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"> qdisc sfq 30: quantum 1500b limit 128p flows 128/1024<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"> qdisc htb 1: r2q 10 default 20 direct_packets_stat 0 ver 3.7<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"> [root@EdenRH9 htb]#<BR> [root@EdenRH9 htb]#<BR> [root@EdenRH9 htb]#<BR> [root@EdenRH9 htb]#<BR> [root@EdenRH9 htb]#<BR> [root@EdenRH9 htb]#<BR> [root@EdenRH9 htb]#<BR> [root@EdenRH9 htb]#<BR> [root@EdenRH9 htb]#<BR>[root@EdenRH9 htb]# tc -s -d qdisc show dev ppp0<BR>qdisc sfq 40: quantum 1500b limit 128p flows 128/1024<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"> qdisc sfq 30: quantum 1500b limit 128p flows 128/1024<BR> Sent 52060 bytes 39 pkts (dropped 0, overlimits 0)</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"> qdisc htb 1: r2q 10 default 20 direct_packets_stat 0 ver 3.7<BR> Sent 52060 bytes 39 pkts (dropped 0, overlimits 65)</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">[root@EdenRH9 htb]# tc -s -d filter show dev ppp0<BR>filter parent 1: protocol ip pref 49151 u32<BR>filter parent 1: protocol ip pref 49151 u32 fh 801: ht divisor 1<BR>filter parent 1: protocol ip pref 49151 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:30<BR> match 00004e22/0000ffff at 20<BR>filter parent 1: protocol ip pref 49151 u32 fh 800: ht divisor 1<BR>filter parent 1: protocol ip pref 49151 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:20<BR> match 00004e21/0000ffff at 20<BR>filter parent 1: protocol ip pref 49152 u32<BR>filter parent 1: protocol ip pref 49152 u32 fh 801: ht divisor 1<BR>filter parent 1: protocol ip pref 49152 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:30<BR> match 00004e22/0000ffff at 20<BR>filter parent 1: protocol ip pref 49152 u32 fh 800: ht
divisor 1<BR>filter parent 1: protocol ip pref 49152 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:20<BR> match 00004e21/0000ffff at 20<BR>[root@EdenRH9 htb]# tc -s -d class show dev ppp0<BR>class htb 1:1 root prio 0 quantum 1000 rate 28Kbit ceil 28Kbit burst 1634b/8 mpu 0b cburst 1634b/8 mpu 0b level 0<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 373714 ctokens: 373714</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">class htb 1:20 root leaf 30: prio 0 quantum 1000 rate 10Kbit ceil 28Kbit burst 1611b/8 mpu 0b cburst 1634b/8 mpu 0b level 0<BR> Sent 52060 bytes 39 pkts (dropped 0, overlimits 0)<BR> rate 131bps<BR> lended: 39 borrowed: 0 giants: 0<BR> tokens: -25088 ctokens: 362744</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">class htb 1:30 root leaf 40: prio 1 quantum 1000 rate 15Kbit ceil 28Kbit burst 1618b/8 mpu 0b cburst 1634b/8 mpu 0b level 0<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 690773 ctokens: 373714</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">[root@EdenRH9 htb]#<BR> ==========================================================<BR></FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Also made a printout from the TCPTRACE output, captured on the other PC with ETHEREAL with the following content:<BR></FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">================================================<BR>1 arg remaining, starting with '/opt/teste_regras20001.ethereal'<BR>Ostermann's tcptrace -- version 6.6.7 -- Thu Nov 4, 2004</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">76 packets seen, 76 TCP packets traced<BR>elapsed wallclock time: 0:00:00.006178, 12301 pkts/sec analyzed<BR>trace file elapsed time: 0:00:39.289997<BR>TCP connection info:<BR>1 TCP connection traced:<BR>TCP connection 1:<BR> host a: 192.168.7.200:35550<BR> host b: 192.168.7.100:20001<BR> complete conn: yes<BR> first packet: Sun Oct 23 20:26:51.304505 2005<BR> last packet: Sun Oct 23 20:27:30.594503 2005<BR> elapsed time: 0:00:39.289997<BR> total packets: 76<BR> filename: /opt/teste_regras20001.ethereal<BR> a->b: b->a:<BR> total
packets: 39 total packets: 37 <BR> ack pkts sent: 38 ack pkts sent: 37 <BR> pure acks sent: 2 pure acks sent: 35 <BR> sack pkts
sent: 0 sack pkts sent: 0 <BR> dsack pkts sent: 0 dsack pkts sent: 0 <BR> max sack blks/ack: 0 max sack blks/ack: 0 <BR> unique bytes sent:
50024 unique bytes sent: 0 <BR> actual data pkts: 36 actual data pkts: 0 <BR> actual data bytes: 50024 actual data bytes: 0 <BR> rexmt data pkts: 0 rexmt data
pkts: 0 <BR> rexmt data bytes: 0 rexmt data bytes: 0 <BR> zwnd probe pkts: 0 zwnd probe pkts: 0 <BR> zwnd probe bytes: 0 zwnd probe bytes:
0 <BR> outoforder pkts: 0 outoforder pkts: 0 <BR> pushed data pkts: 10 pushed data pkts: 0 <BR> SYN/FIN pkts sent: 1/1 SYN/FIN pkts sent: 1/1 <BR> req 1323
ws/ts: Y/Y req 1323 ws/ts: Y/Y <BR> adv wind scale: 0 adv wind scale: 0 <BR> req sack: Y req sack: Y <BR> sacks
sent: 0 sacks sent: 0 <BR> urgent data pkts: 0 pkts urgent data pkts: 0 pkts <BR> urgent data bytes: 0 bytes urgent data bytes: 0 bytes<BR> mss requested: 1460 bytes mss
requested: 1460 bytes<BR> max segm size: 1448 bytes max segm size: 0 bytes<BR> min segm size: 24 bytes min segm size: 0 bytes<BR> avg segm size: 1389 bytes avg segm size: 0 bytes<BR> max win adv: 5840
bytes max win adv: 63712 bytes<BR> min win adv: 5840 bytes min win adv: 5792 bytes<BR> zero win adv: 0 times zero win adv: 0 times<BR> avg win adv: 5840 bytes avg win adv: 46818 bytes<BR> initial
window: 24 bytes initial window: 0 bytes<BR> initial window: 1 pkts initial window: 0 pkts <BR> ttl stream length: 50024 bytes ttl stream length: 0 bytes<BR> missed data: 0 bytes missed data: 0 bytes<BR>
truncated data: 0 bytes truncated data: 0 bytes<BR> truncated packets: 0 pkts truncated packets: 0 pkts <BR> data xmit time: 37.430 secs data xmit time: 0.000 secs <BR> idletime max: 2370.0 ms idletime max: 2374.2 ms <BR>
throughput: 1273 Bps throughput: 0 Bps <BR>=============================================================</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Why are the rules for RATE being the only ones that are taken into account for bandwidth limitation and HTB does not care about the CEIL in class (1:20) and borrows tokens from the other class (1:30) that’s not being utilized?</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Can I still have a problem with software versions (Linux, HTB or TC) ?</FONT></DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"></FONT> </DIV>
<DIV class=RTE><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Can there be a problem of correct shaping in HTB for smaller bitrates ?</FONT></DIV><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">
<DIV class=RTE><BR>Thanks in advance.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Best regards.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Paulo AUgusto<BR></FONT></DIV>
<P><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">
<HR color=#a0c6e5 SIZE=1>
</P>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>From: <I>Andy Furniss <andy.furniss@dsl.pipex.com></I><BR>Reply-To: <I>andy.furniss@dsl.pipex.com</I><BR>To: <I>Paulo Augusto <augustopaulo@hotmail.com></I><BR>CC: <I>lartc@mailman.ds9a.nl</I><BR>Subject: <I>Re: [LARTC] Lost packets and strange "behaviour" of my TC rules</I><BR>Date: <I>Mon, 17 Oct 2005 22:29:12 +0100</I><BR>>Paulo Augusto wrote:<BR>><BR>><BR>>><BR>>>I'm using the TG (www.postel.org/tg <http://www.postel.org/tg>) as <BR>>>a TCP traffic generator, to establish three 90kbits/s TCP flows <BR>>>from PC1(any port) to PC2(port 20000, 20001 and 20002), with <BR>>>different durations and pause times, which as can be shown in the <BR>>>next files:<BR>><BR>>Usually tcp won't be like this, netperf may be better to test with, <BR>>as
it's more normal for bulk tcp to try to go as fast as it can.<BR>><BR>>><BR>>>I've also plotted a graph with gnuplot, showing me that (somehow) <BR>>>my rules were "correct", I've got an average value of 30kbits/s, a <BR>>>10kbits/s and a 60kbits/s.<BR>>><BR>>>Is it normal that some packets get dropped by the rules or not <BR>>>(taking into account my test configuration) ?<BR>><BR>>The packets are not dropped in this case as the default queue length <BR>>for sfq is 128, which can hold a rwin worth of data. The missing <BR>>packets just didn't get sent because htb slowed the packets down to <BR>>the rates specified and the sender will only send more once the ones <BR>>already sent are acked.<BR>><BR>>Andy.<BR>><BR></FONT></BLOCKQUOTE></div></html>