]> code.delx.au - monosys/commitdiff
Improved shaper script
authorJames Bunton <jamesbunton@fastmail.fm>
Sun, 6 Jun 2010 01:38:00 +0000 (11:38 +1000)
committerJames Bunton <jamesbunton@fastmail.fm>
Sun, 6 Jun 2010 01:38:00 +0000 (11:38 +1000)
 * Removed downlink stuff as it never worked right
 * Fixed shaping of ACK packets

scripts/shaper

index 52376bb9dd0d4cb200932135dc6dfd0129c1c63c..9e5c8bcdf99ce207622a0c308bbb1df1e88daec2 100755 (executable)
@@ -1,21 +1,31 @@
 #!/bin/bash
 
+# Docs: http://lartc.org/howto
+
 # Tweakables
 IFACE="ppp0"
 VOIP_HOST="203.2.134.1"
 
-UPLINK_RATE=192
-DOWNLINK_RATE=1024
+UPLINK_RATE=900
 R2Q=2
 
-VOIP_RATE=64
-HIGH_RATE=32
-NORM_RATE=64
-BULK_RATE=32
+VOIP_RATE=70
+HIGH_RATE=230
+NORM_RATE=350
+BULK_RATE=250
+
+
+# Symbolic 'constants'
+ROOT=1
+LIMIT=1
+VOIP_TRAFFIC=10
+HIGH_TRAFFIC=20
+NORM_TRAFFIC=30
+BULK_TRAFFIC=40
+
 
 
 
-cd /
 
 # Print status of classes
 if [ "$1" = "status" ]
@@ -35,16 +45,7 @@ then
        exit
 fi
 
-
-# Symbolic 'constants'
-ROOT=1
-LIMIT=1
-VOIP_TRAFFIC=10
-HIGH_TRAFFIC=20
-NORM_TRAFFIC=30
-BULK_TRAFFIC=40
-
-
+cd /
 
 ########## uplink #############
 
@@ -106,16 +107,6 @@ tc filter add dev ${IFACE} \
        parent ${ROOT}:0 protocol ip prio 10 u32 \
        match ip protocol 1 0xff 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}
-
 # 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 \
@@ -125,22 +116,14 @@ tc filter add dev ${IFACE} \
        match u8 0x10 0xff at 33 \
        flowid ${ROOT}:${HIGH_TRAFFIC}
 
-
-
-########## downlink #############
-
-tc qdisc add dev ${IFACE} \
-       handle ffff: ingress
-
-# Matching incoming VoIP traffic here so it isn't policed by the next rule
+# TOS Minimum-Delay (eg ssh but not scp) in HIGH_TRAFFIC
 tc filter add dev ${IFACE} \
-       parent ffff: protocol ip prio 1 u32 \
-       match ip src ${VOIP_HOST}/32 \
-       flowid :1
+       parent ${ROOT}:0 protocol ip prio 10 u32 \
+       match ip tos 0x10 0xff flowid ${ROOT}:${HIGH_TRAFFIC}
 
-# Police everything else - drop packets coming in faster than DOWNLINK_RATE
+# TOS Maximise-Throughput (eg rtorrent) in BULK_TRAFFIC
 tc filter add dev ${IFACE} \
-       parent ffff: protocol ip prio 2 u32 \
-       match ip src 0.0.0.0/0 \
-       police rate ${DOWNLINK_RATE}Kbit burst 10k drop flowid :2
+       parent ${ROOT}:0 protocol ip prio 10 u32 \
+       match ip tos 0x08 0xff flowid ${ROOT}:${BULK_TRAFFIC}
+