echo "Nettoyage"
echo "tc qdisc del root dev eth1"
tc qdisc del root dev eth1

echo "Definition root"
echo "tc qdisc add dev eth1 root handle 1: cbq bandwidth 10Mbit avpkt 1000"
tc qdisc add dev eth1 root handle 1: cbq bandwidth 10Mbit avpkt 1000

echo "Definition 1er container de 5Mbit"
echo "tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 10Mbit allot 1514 rate 5Mbit avpkt 1000 bounded maxburst 65"
tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 10Mbit allot 1514 rate 5Mbit avpkt 1000 bounded maxburst 65

echo "Definition classe QBSS"
echo "tc class add dev eth1 parent 1:1 classid 1:10 cbq bandwidth 5Mbit rate 100Kbit allot 1514 maxburst 1 avpkt 1000 weight 120Mbit prio 1"
tc class add dev eth1 parent 1:1 classid 1:10 cbq bandwidth 5Mbit rate 100Kbit allot 1514 maxburst 1 avpkt 1000 weight 120Mbit prio 1

echo "#Definition classe BestEffort"
echo "tc class add dev eth1 parent 1:1 classid 1:20 cbq bandwidth 5Mbit rate 4900kbit allot 1514 maxburst 172 avpkt 1000 weight 1Mbit prio 8 bounded"
tc class add dev eth1 parent 1:1 classid 1:20 cbq bandwidth 5Mbit rate 4900Kbit allot 1514 maxburst 172 avpkt 1000 weight 1Mbit prio 8 bounded

echo "#Gestion des files"
echo "tc qdisc add dev eth1 parent 1:10 handle 2: cbq bandwidth 5Mbit rate 5Mbit avpkt 1000"
tc qdisc add dev eth1 parent 1:10 handle 2: cbq bandwidth 5Mbit rate 100Kbit avpkt 1000

echo "tc qdisc add dev eth1 parent 1:20 handle 3: cbq bandwidth 5Mbit rate 490kbit avpkt 1000"
tc qdisc add dev eth1 parent 1:20 handle 3: cbq bandwidth 5Mbit rate 4900Kbit avpkt 1000

echo "#Definition des filtres"

echo "tc filter add dev eth1 parent 1:0 prio 100 protocol ip u32 match ip src 192.168.1.2 flowid 1:20"
tc filter add dev eth1 parent 1:0 prio 100 protocol ip u32 match ip src 192.168.1.2 flowid 1:20

echo "tc filter add dev eth1 parent 1:0 prio 100 protocol ip u32 match ip src 192.168.1.3 flowid 1:10"
tc filter add dev eth1 parent 1:0 prio 100 protocol ip u32 match ip src 192.168.1.3 flowid 1:10

echo "#observation du rangement dans le différentes files liées au lien de sortie eth1
tc –s qdisc ls dev eth1