#!/bin/sh DEV="ppp0" UPLINK="448" UPLINK_SMALLER="320" DOWNLINK="8128" tc qdisc del dev "$DEV" root >/dev/null 2>&1 tc qdisc add dev "$DEV" root handle 1: htb default 30 tc class add dev "$DEV" parent 1: classid 1:1 htb rate "${UPLINK}kbit" burst 6k # Absolute maximum priority tc class add dev "$DEV" parent 1:1 classid 1:10 htb rate "${UPLINK}kbit" burst 6k prio 1 tc qdisc add dev "$DEV" parent 1:10 handle 10: htb # High priority tc class add dev "$DEV" parent 1:1 classid 1:20 htb rate "${UPLINK}kbit" burst 6k prio 2 tc qdisc add dev "$DEV" parent 1:20 handle 20: htb # Low priority tc class add dev "$DEV" parent 1:1 classid 1:30 htb rate "${UPLINK_SMALLER}kbit" burst 6k prio 3 tc qdisc add dev "$DEV" parent 1:30 handle 30: htb # Match UDP tc filter add dev "$DEV" parent 1:0 protocol ip prio 1 u32 match ip protocol 0x11 0xff flowid 1:10 # Match interactive TOS tc filter add dev "$DEV" parent 1:0 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:20 # Match ICMP tc filter add dev "$DEV" parent 1:0 protocol ip prio 10 u32 match ip protocol 1 0xff flowid 1:20 # Match ACK tc filter add dev "$DEV" parent 1: protocol ip prio 10 u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match u8 0x10 0xff at 33 flowid 1:20