Home Page

23/11/2001 : This page is not valid. Plz go to docum.org 

 

 

 

  • What I wanna do
  • I want to know how accurate CBQ can split the bandwidth when you use different rates and provides no weight parameter.

  • Used script
  • Used script (download)

    #!/bin/sh
    RATE_TOT=100        # In KiloBytes/Sec
    RATE1=90
    RATE1=`expr $RATE_TOT \* $RATE1`
    RATE1=`expr $RATE1 / 100`
    RATE2=`expr $RATE_TOT - $RATE1`
    
    RATE_TOT=$RATE_TOT`echo kbps`
    RATE1=$RATE1`echo kbps`
    RATE2=$RATE2`echo kbps`
    
    echo rate_tot: $RATE_TOT
    echo rate1: $RATE1
    echo rate1: $RATE2
    
    PRIO1="prio 3"
    PRIO2="prio 3"
     
    IP=kriek
    DEV="dev eth0"
    OPTION="allot 1514 maxburst 20 avpkt 1000"
    
    tc qdisc del $DEV root
    tc qdisc add $DEV root handle 10: cbq bandwidth 10mbit avpkt 1000
    tc class add $DEV parent 10:0 classid 10:2 cbq bandwidth 10mbit rate $RATE_TOT $OPTION prio 3 bounded
     
    tc qdisc add $DEV parent 10:2 handle 20: cbq bandwidth $RATE_TOT allot 1514 avpkt 1000
    
    tc class add $DEV parent 20: classid 20:10 cbq bandwidth $RATE_TOT rate $RATE1 $OPTION $PRIO1
    #tc qdisc add $DEV parent 20:10 handle 30: sfq
    tc class add $DEV parent 20: classid 20:20 cbq bandwidth $RATE_TOT rate $RATE2 $OPTION $PRIO2
    #tc qdisc add $DEV parent 20:20 handle 40: sfq
     
    tc filter add $DEV parent 10: protocol ip prio 3 handle 1 fw classid 10:2
    tc filter add $DEV parent 10: protocol ip prio 3 handle 2 fw classid 10:2
    tc filter add $DEV parent 20: protocol ip prio 3 handle 1 fw classid 20:10
    tc filter add $DEV parent 20: protocol ip prio 3 handle 2 fw classid 20:20
    
    iptables -F
    iptables -X
    iptables -N acc_0
    iptables -N acc_1
    iptables -A OUTPUT -t mangle -p tcp --dport 2000 -j MARK --set-mark 1
    iptables -A OUTPUT -t mangle -p tcp --dport 2001 -j MARK --set-mark 2
    iptables -A OUTPUT -p tcp --dport 2000 -j acc_0
    iptables -A OUTPUT -p tcp --dport 2001 -j acc_1
    

  • Results
  • RATE1RATE2RATE1/RATE_TOT
    TheoryTests
    50 5050%50%
    60 4060%60%
    70 3070%70%
    75 2575%75%
    80 2080%75.3%
    85 1585%81.3%
    90 1090%87.5%
    95 5 95%93.5%
    97 3 97%96.0%
    98 2 98%97.3%
    99 1 99%98.7%

  • Conclusion
  • The traffic is shaped and this is allmost perfect done.

    When you provide no weight parameter, the system chooses a default one. When you execure tc -s -d qdisc, you can see that the choosen weight is equal to the rate. And this gives good results. This is also the conclusion of the other page about splitting the traffic in different classes.

  • Extra tests
  • I deleted the qdisc 20: and attached the classes to the parent class 10:1. The results was clear. Each class gets 50% of the bandwidth, but the total bandwidth is bounded to 100kbps. So the traffic is not splitted in the different classes.

    When you attach the filtes to 10: and put the traffic directly in 10:10 and 10:20, the bandwidth is totally not managed. Each class gets 50% of the full bandwidth (10mbit).

  • Used script
  • Used script (download)