#!/bin/bash
#Example config for an adsl link with 1024Kbit downstream and 128Kbit upstream
iptables -t mangle -A OUTPUT -m length --length 0:500 -j MARK --set-mark 3
iptables -t mangle -A OUTPUT -m length --length 500:1500 -j MARK --set-mark 4
#We assume masqueraded machines on eth0 should also have their upload tuned
iptables -t mangle -A PREROUTING -i eth0 -m length --length 0:500 -j MARK --set-mark 3
iptables -t mangle -A PREROUTING -i eth0 -m length --length 500:1500 -j MARK --set-mark 4
tc qdisc add dev ppp0 root handle 10: cbq bandwidth 10Mbit avpkt 1000 mpu 64
tc class add dev ppp0 parent 10:0 classid 10:1 cbq bandwidth 10Mbit \
rate 51Kbit allot 1514 prio 1 maxburst 10 avpkt 100 isolated
tc class add dev ppp0 parent 10:0 classid 10:2 cbq bandwidth 10Mbit \
rate 77Kbit allot 1514 prio 8 maxburst 2 avpkt 1500 bounded
tc filter add dev ppp0 parent 10:0 protocol ip handle 3 fw flowid 10:1
tc filter add dev ppp0 parent 10:0 protocol ip handle 4 fw flowid 10:2