X-Git-Url: https://code.delx.au/monosys/blobdiff_plain/185b29269ce12a4ed796333300944c1f3f994992..468b442da9caba54b39054ac0cf6d33a2f1234d0:/scripts/shaper diff --git a/scripts/shaper b/scripts/shaper deleted file mode 100755 index 1751105..0000000 --- a/scripts/shaper +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - -# Docs: http://lartc.org/howto - -# Tweakables -IFACE="ppp0" -VOIP_HOST="$(dig +short sip.internode.on.net)" - -UPLINK_RATE=450 - -VOIP_RATE=70 -HIGH_RATE=130 -NORM_RATE=240 -BULK_RATE=10 - - -# Symbolic 'constants' -ROOT=1 -LIMIT=1 -VOIP_TRAFFIC=10 -HIGH_TRAFFIC=20 -NORM_TRAFFIC=30 -BULK_TRAFFIC=40 - - -# Print status of classes -if [ "$1" = "status" ]; then - tc -s qdisc ls dev ${IFACE} - tc -s class ls dev ${IFACE} - exit -fi - -set -x - -# clean existing down- and uplink qdiscs, hide errors -tc qdisc del dev ${IFACE} root 2> /dev/null > /dev/null -tc qdisc del dev ${IFACE} ingress 2> /dev/null > /dev/null - -if [ "$1" = "stop" ]; then - exit -fi - -cd / - - -########## uplink ############# - -# install root HTB, point default traffic to NORM_TRAFFIC -tc qdisc add dev ${IFACE} \ - root handle ${ROOT}:0 \ - htb default ${NORM_TRAFFIC} - - -# LIMIT class shapes everything at $UPLINK_RATE speed -# this prevents huge queues in the DSL modem which destroy latency -tc class add dev ${IFACE} \ - parent ${ROOT}:0 classid ${ROOT}:${LIMIT} \ - htb rate ${UPLINK_RATE}Kbit ceil ${UPLINK_RATE}Kbit - - -# VoIP traffic class gets guaranteed bandwidth -tc class add dev ${IFACE} \ - parent ${ROOT}:${LIMIT} classid ${ROOT}:${VOIP_TRAFFIC} \ - htb rate ${VOIP_RATE}Kbit ceil ${UPLINK_RATE}Kbit prio 0 - -# High priority traffic -tc class add dev ${IFACE} \ - parent ${ROOT}:${LIMIT} classid ${ROOT}:${HIGH_TRAFFIC} \ - htb rate ${HIGH_RATE}Kbit ceil ${UPLINK_RATE}Kbit prio 1 - -# Normal priority traffic -tc class add dev ${IFACE} \ - parent ${ROOT}:${LIMIT} classid ${ROOT}:${NORM_TRAFFIC} \ - htb rate ${NORM_RATE}Kbit ceil ${UPLINK_RATE}Kbit prio 2 - -# Bulk traffic gets little default allowance -tc class add dev ${IFACE} \ - parent ${ROOT}:${LIMIT} classid ${ROOT}:${BULK_TRAFFIC} \ - htb rate ${BULK_RATE}Kbit ceil ${UPLINK_RATE}Kbit prio 3 - - -# Stochastic Fairness -tc qdisc add dev ${IFACE} \ - parent ${ROOT}:${HIGH_TRAFFIC} handle ${HIGH_TRAFFIC}:0 \ - sfq perturb 10 -tc qdisc add dev ${IFACE} \ - parent ${ROOT}:${NORM_TRAFFIC} handle ${NORM_TRAFFIC}:0 \ - sfq perturb 10 -tc qdisc add dev ${IFACE} \ - parent ${ROOT}:${BULK_TRAFFIC} handle ${BULK_TRAFFIC}:0 \ - sfq perturb 10 - - -# Match VoIP traffic as highest priority -tc filter add dev ${IFACE} \ - parent ${ROOT}:0 protocol ip prio 10 u32 \ - match ip dst ${VOIP_HOST} flowid ${ROOT}:${VOIP_TRAFFIC} - -# ICMP in the HIGH_TRAFFIC class -tc filter add dev ${IFACE} \ - parent ${ROOT}:0 protocol ip prio 10 u32 \ - match ip protocol 1 0xff flowid ${ROOT}:${HIGH_TRAFFIC} - -# To speed up downloads while an upload is going on, ACK is HIGH_TRAFFIC -tc filter add dev ${IFACE} \ - parent ${ROOT}:0 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 ${ROOT}:${HIGH_TRAFFIC} - -# TOS Minimum-Delay (eg ssh but not scp) in HIGH_TRAFFIC -tc filter add dev ${IFACE} \ - parent ${ROOT}:0 protocol ip prio 10 u32 \ - match ip tos 0x10 0xff flowid ${ROOT}:${HIGH_TRAFFIC} - -# TOS Maximise-Throughput (eg rtorrent) in BULK_TRAFFIC -tc filter add dev ${IFACE} \ - parent ${ROOT}:0 protocol ip prio 10 u32 \ - match ip tos 0x08 0xff flowid ${ROOT}:${BULK_TRAFFIC} -