#!/bin/sh
RATE_TOT=140kbps
IP=kriek
RATE1=100kbps
PRIO1="prio 3"
 
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:1 cbq bandwidth 10mbit rate $RATE_TOT $OPTION bounded prio 3
 
tc class add $DEV parent 10:1 classid 10:10 cbq bandwidth $RATE_TOT rate $RATE1 $WEIGHT1 $OPTION $PRIO1 bounded

tc filter add $DEV parent 10: protocol ip prio 3 handle 1 fw classid 10:1 # red filter
tc filter add $DEV parent 10:1 protocol ip prio 3 handle 1 fw classid 10:10 # green filter
 
# tc filter add $DEV parent 10: protocol ip prio 3 handle 1 fw classid 10:10 # blue filter

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 -p tcp --dport 2000 -j acc_0
