<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

<channel>
<title>[General] Traffic Shaper script that actually works! in VOIP Tech Chat</title>
<link>http://www.dslreports.com/forum/r13423584</link>
<description></description>
<language>en</language>
<pubDate>Wed, 02 Dec 2009 15:12:50 EDT</pubDate>
<lastBuildDate>Wed, 02 Dec 2009 15:12:50 EDT</lastBuildDate>

<item>
<title>Re: [General] Traffic Shaper script that actually</title>
<link>http://www.dslreports.com/forum/remark,13424103</link>
<description><![CDATA[<A HREF="/useremail/u/899169"><b>dleaberr</b></A> : Good job. I love using linux for my firewall router. A long time search shows a thread where some of the details are discussed along with a few other script versions. <br><br>&raquo;<A HREF="/forum/remark,10233058~mode=flat~days=9999">[BroadVoice] Linux VOIP Router QOS script</A><br>Disclaimer: I am Daniel Leaberry<br><br>I still think the best way is to study a few of these scripts and then customize them to fit your particular situation. I use shorewall so I don't need specific iptables commands. Others use just iptables so it's fitting to have the commands.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,13424103</guid>
<pubDate>Mon, 16 May 2005 21:48:20 EDT</pubDate>
</item>

<item>
<title>[General] Traffic Shaper script that actually works!</title>
<link>http://www.dslreports.com/forum/remark,13423584</link>
<description><![CDATA[<A HREF="/useremail/u/645385"><b>scamiran</b></A> : Hi all.<br>EDIT: This is for linux. It uses iptables and tc, so a recent-ish (2.4+) linux.<br>2nd EDIT: I've attached the file. Word wrap messes it up.<br><br>I'm kind of a noob at this thing, and really shouldn't take any credit for this, as it is all other peoples work, but I'll try and take credit for posting it here. I didn't find it in searches (on this board), so perhaps this is useful to someone.<br><br>The problem I've found that Wondershaper really only allows you to configure what should be low priority; it doesn't allow you to set a 'high' priority flag on certain traffic. This script, mostly from Matt Goebel (mlg9000(Errr...at)yahoo(dot)com), does the trick, however. I've changed just a couple lines, and added ICMP requests to high priority, so your ping times will always look good. <br><br>With Wondershaper, no matter how I set my PC to be low priority, and how low I'd set the caps (1/4 of my upload/download) my vonage would still break up. Here? I have no problems at all. Rock solid.<br><br>Works GREAT. This is what I expected out of wondershaper. I've tried to break it every which way, and its flawless.<br><br>So, here it is:<br><div class="code"><PRE><span class="codetext">#!/bin/bash<br>#<br># Linux Traffic Shaper Script (LTSS) version 0.1 beta (5/27/04)<br># ----------------------------------------------------------------------------------        ------<br> *---------<br># (c) Copyright 2004, Matt Goebel (mlg9000(Errr...at)yahoo(dot)com)<br>#<br># This program is free software; you can redistribute it and/or modify<br># it under the terms of the GNU General Public License as published by<br># the Free Software Foundation; either version 2 of the License, or<br># (at your option) any later version.<br>#<br># This program is distributed in the hope that it will be useful,<br># but WITHOUT ANY WARRANTY; without even the implied warranty of<br># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br># GNU General Public License for more details.<br>#<br># You should have received a copy of the GNU General Public License<br># along with this program; if not, write to the Free Software<br># Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA<br>#<br># Credit:<br># ----------------------------------------------------------------------------------        ------<br> *---------<br># Daniel Leaberry's tcstart script<br># Wondershaper 1.1a<br># knowplace.org and the narc firewall<br>#<br># Purpose / Function:<br># ----------------------------------------------------------------------------------        ------<br> *---------<br># This script was written to provide traffic shaping for my own personal LAN's cable Inter<br> *net<br># connection. It ensures that regular network traffic does not interfere with my VOIP serv<br> *ice.<br># (Vonage.com) It also prioritizes other forms of interactive traffic so that uploads do n<br> *ot have as<br># big an impact on them as they otherwise would.  Only upstream traffic is shaped as downs<br> *tream traffic<br># is largely beyond our control.  At the moment this is a very simple script.  In the<br># future it's functionality may be expanded upon and improved.  If you find this script us<br> *eful,<br># if you find any errors, or you have suggestions on ways to improve it, please let me kno<br> *w.<br>#<br># Prerequisites:<br># ----------------------------------------------------------------------------------        ------<br> *---------<br># 1. A modern Linux kernel /w HTB (http://luxik.cdi.cz/~devik/qos/htb/index2.htm) support <br> *enabled<br>#    and the Netfilter module ipt_CLASSIFY.ko available (ipt_CLASSIFY.o for 2.4 kernels)<br># 2. iproute /w tc that supports HTB<br># 3. ipchains with CLASSIFY support (specifically libipt_CLASSIFY.so must be included)<br># 4. A VOIP router from any provider, or VOIP software<br>#<br># Usage:<br># ----------------------------------------------------------------------------------        ------<br> *---------<br># Start the script - "ltss start"<br># Stop the script - "ltss stop"<br># Restart the script - "ltss restart"<br># Show the Status - "ltss status"<br>#<br># Note: Check your firewall rules to be sure this does not conflict with the rules set the<br> *re<br>#<br># Tested and known to work on (let me know so I can add these):<br># - Fedora Core 2 (stock kernel, out of the box no special steps required)<br>#<br># Installation:<br># ----------------------------------------------------------------------------------        ------<br> *---------<br># 1. Modify the listed variables below to match your needs<br># 2. Make this script executable and owned by root (chown root:root ltss, chmod 700 ltss)<br># 3. Place this script in your start files (Optional)<br>#<br># Variables (change these as needed):<br># ----------------------------------------------------------------------------------        ------<br> *---------<br> <br>TC=/usr/sbin/tc             # Path to the tc command<br>IPTABLES=/usr/sbin/iptables # Path to the iptables command<br>UPSTREAM="450Kbit"      # Tweak this as needed (~90% total upload bandwidth is a good star<br> *t)<br>EXTINT="eth0"           # External Interface<br>VOIP1="5060:5061"       # First port (or range) used by VOIP (UDP)<br>VOIP2="10000:20000"     # Second port range used by VOIP (Optional UDP - required for Vona<br> *ge)<br>FPRIORITY="200Kbit"     # VOIP bandwidth req. (2x max bandwidth required for highest quali<br> *ty call, used for 3 way calling)<br>SPRIORITY="150Kbit"     # Interactive and other higher priority bandwidth req.<br>LASTPRIORITY="100Kbit"  # Everything else (should be the rest of the bandwidth you have le<br> *ft)<br>HP="domain,http,pop3,imap,https,imaps,ftp"  # TCP Traffic you want to give priority to (SS<br> *H already included<br>HPTCP=""                # Other TCP traffic you want to give priority to (Port or Range of<br> * Ports)<br>HPUDP="53"                # Other UDP traffic you want to give priority to (Port or Range <br> *of Ports)<br> <br># Script portion (should not need modification):<br># ----------------------------------------------------------------------------------        ------<br> *---------<br> <br>if &#91; "$1" == "start" &#93; || &#91; "$1" == "restart" &#93; || &#91; "$1" == "stop" &#93;; then<br>        # Flush everything<br>        $TC qdisc del dev $EXTINT root 2&gt; /dev/null &gt; /dev/null<br>        fi<br>if &#91; "$1" == "start" &#93; || &#91; "$1" == "restart" &#93;; then<br>        # Start Traffic Shaper<br>        if &#91; "$1" == "start" &#93;; then<br>                echo "Starting Traffic Shaper........"<br>                fi<br>        if &#91; "$1" == "restart" &#93;; then<br>                echo "Restarting Traffic Shaper........"<br>                fi<br>        # Load CLASSIFY module<br>        modprobe ipt_CLASSIFY<br>        # Setup classes<br>        $TC qdisc add dev $EXTINT root handle 1: htb default 12 r2q 3<br>        $TC class add dev $EXTINT parent 1: classid 1:1 htb rate $UPSTREAM<br>        $TC class add dev $EXTINT parent 1:1 classid 1:10 htb rate $FPRIORITY ceil $UPSTRE<br> *AM prio 0<br>        $TC class add dev $EXTINT parent 1:1 classid 1:11 htb rate $SPRIORITY ceil $UPSTRE<br> *AM prio 1<br>        $TC class add dev $EXTINT parent 1:1 classid 1:12 htb rate $LASTPRIORITY ceil $UPS<br> *TREAM prio 2<br>        $TC qdisc add dev $EXTINT parent 1:10 handle 10: sfq perturb 10<br>        $TC qdisc add dev $EXTINT parent 1:11 handle 11: sfq perturb 10<br>        $TC qdisc add dev $EXTINT parent 1:12 handle 12: sfq perturb 10<br>        # VOIP traffic<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p udp --dport $VOIP1 -j CLASSIFY --s<br> *et-class 1:10<br>        if &#91; "$VOIP2" != "" &#93;; then<br>                iptables -t mangle -A POSTROUTING -o $EXTINT -p udp --dport $VOIP2 -j CLAS<br> *SIFY --set-class 1:10<br>                fi<br>        # Setup secondary traffic<br>        # Give "overhead" packets priority<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp --syn -m length --length 40:68<br> * -j CLASSIFY --set-class 1:11<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp --tcp-flags ALL SYN,ACK -m len<br> *gth --length 40:68 -j CLASSIFY --set-class 1:11<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp --tcp-flags ALL ACK -m length <br> *--length 40:100 -j CLASSIFY --set-class 1:11<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp --tcp-flags ALL RST -j CLASSIF<br> *Y --set-class 1:11<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp --tcp-flags ALL ACK,RST -j CLA<br> *SSIFY --set-class 1:11<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp --tcp-flags ALL ACK,FIN -j CLA<br> *SSIFY --set-class 1:11<br>        # Interactive SSH traffic<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp --sport ssh -m length --length<br> * 40:100 -j CLASSIFY --set-class 1:11<br>        iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp --dport ssh -m length --length<br> * 40:100 -j CLASSIFY --set-class 1:11<br>        # Interactive traffic<br>        if &#91; "$HP" != "" &#93;; then<br>                iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp -m multiport --dport $<br> *HP -j CLASSIFY --set-class 1:11<br>                fi<br>        # improve ICMP results<br>        tc filter add dev $EXTINT parent 1:0 protocol ip prio 10 u32 \<br>               match ip protocol 1 0xff flowid 1:10<br> <br>        # Other TCP/UDP traffic<br>        if &#91; "$HPTCP" != "" &#93;; then<br>                iptables -t mangle -A POSTROUTING -o $EXTINT -p tcp -m multiport --dport $<br> *HPTCP -j CLASSIFY --set-class 1:11<br>                fi<br>        if &#91; "$HPUDP" != "" &#93;; then<br>                iptables -t mangle -A POSTROUTING -o $EXTINT -p udp -m multiport --dport $<br> *HPUDP -j CLASSIFY --set-class 1:11<br>                fi<br>        echo "Done."<br>        exit 0<br>        fi<br>if &#91; "$1" == "stop" &#93;; then<br>        # Stop Traffic Shaper<br>        echo "Stopping Traffic Shaper........"<br>        echo "Done."<br>        exit 0<br>        fi<br>if &#91; "$1" == "status" &#93;; then<br>        # Show Status<br>        echo "Current Traffic Shaper Status:"<br>        echo "---------------------------------------------------------------------------"<br>        tc -s qdisc ls dev $EXTINT<br>        tc -s class ls dev $EXTINT<br>        exit 0<br>        fi<br>if &#91; "$1" != "start" &#93; &amp;&amp; &#91; "$1" != "restart" &#93; &amp;&amp; &#91; "$1" != "stop" &#93; &amp;&amp; &#91; "$1" != "status<br> *" &#93;; then<br>        echo "Bad or missing parameters"<br>        echo "Usage: { start | stop | restart | status }"<br>        echo "start          = Start traffic shaper"<br>        echo "stop           = Stop traffic shaper"<br>        echo "restart        = Restart traffic shaper"<br>        echo "status         = Show status of traffic shaper"<br>        exit 1<br>        fi<br><br>(*) WARNING 40 long line(s) split</SPAN></PRE></DIV>Keep in mind, I really had nothing to do with this, but its actually fairly simple to understand, and really does a much better job than wondershaper. You have to configure the settings at the top, but after that, everything works swimmingly. Place questions here. I'm sure I can't answer them, but there's probably someone here who can.<br><br>This setup really is flawless. I highly recommend it. Running azureus full time no longer even disrupts my ping times, my web browsing, my Vonage, or ssh. <br><br>Even when its cranked (like right now, uploading at 49 kB/s).<div class="borderless"><TABLE WIDTH=95% align=center border=0 CELLPADDING=4"><TR><TD ALIGN=CENTER VALIGN=CENTER BGCOLOR=#000000 nwrap WIDTH=33%><A HREF="/r0/download/825712~19a799cf1166d1c424abd7d12c0f213a/ltss.zip"><IMG  align=absmiddle TITLE="download" SRC="http://i.dslr.net/silk/compress.png" border=0 width=16 height=16><IMG SRC="http://i.dslr.net/1ptrans.gif" WIDTH=10 HEIGHT=1 border=0><big>ltss.zip</big></A> <small>2,885 bytes</small><br><small>(ltss)</small></TD></TABLE></div>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,13423584</guid>
<pubDate>Mon, 16 May 2005 20:42:17 EDT</pubDate>
</item>

</channel>
</rss>
