Results 1 to 1 of 1
Hi In the script below I want to lmit all of my users to 1200mbit and a max of 256kbit per user. I did read a lot and I was ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-19-2009 #1
- Join Date
- Dec 2006
Help with CBQ classes
In the script below I want to lmit all of my users to 1200mbit and a max of 256kbit per user. I did read a lot and I was finally able to get to the below. The problem with this is that users are using much more than their 256kbit. If I remove the definition of the 1200mbit class 11:1/20 and change the children classes that limit 256 accordingly the traffic is limited to 256kbit per host. So it must be something with the definition of hte main bandwidth.
##Define Variables TC=/sbin/tc DNLD=256Kbit # DOWNLOAD Limit DWEIGHT=25Kbit # DOWNLOAD Weight Factor ~ 1/10 of DOWNLOAD Limit UPLD=256KBit # UPLOAD Limit UWEIGHT=25Kbit # UPLOAD Weight Factor INT=eth2 EXT=eth1 ##Create Root Disk $TC qdisc add dev $INT root handle 11: cbq bandwidth 100Mbit avpkt 1000 mpu 64 ##Create main class with total rate 1200kbit $TC class add dev $INT parent 11:0 classid 11:1 cbq bandwidth 100Mbit rate 1200Kbit allot 1514 prio 1 avpkt 1000 isolated bounded ##Create Child class with BW 1200 $TC qdisc add dev $INT parent 11:1 handle 20: cbq bandwidth 1200Kbit allot 1514 avpkt 1000 ##Create Subclass with 256kbit limit $TC class add dev $INT parent 20:0 classid 20:2 cbq rate $DNLD weight $DWEIGHT allot 1514 prio 1 avpkt 1000 bounded ##Create Appropriate Mark for subclass $TC filter add dev $INT parent 20:0 protocol ip handle 2 fw flowid 20:2 ##Mark The Packets as neccessary.. iptables -t mangle -A POSTROUTING -s ! 192.168.0.0/24 -d 192.168.0.2 -j MARK --set-mark 2 ### Same for another IP. iptables -t mangle -A FORWARD -s 192.168.0.5 -j MARK --set-mark 257 $TC class add dev $INT parent 20:0 classid 20:3 cbq rate $DNLD weight $DWEIGHT allot 1514 prio 1 avpkt 1000 bounded $TC filter add dev $INT parent 20:0 protocol ip handle 3 fw flowid 20:3 etc for the rest of the IPs