Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: nix4me <nix4me@cfl.rr.com>
To: lartc@vger.kernel.org
Subject: [LARTC] tweaked shaping rules
Date: Sun, 05 Mar 2006 20:33:11 +0000	[thread overview]
Message-ID: <440B4B07.8060005@cfl.rr.com> (raw)

I wanted to post my new shaping rules which I am running on my IPCOP 
router.  They seem to be working very well so far.  Any comments to my 
setup would be appreciated.

#!/bin/bash

# clear out the chain and setup a new chain
iptables -t mangle -D OUTPUT -o eth1 -j BW-OUT 2> /dev/null > /dev/null
iptables -t mangle -F BW-OUT 2> /dev/null > /dev/null
iptables -t mangle -X BW-OUT 2> /dev/null > /dev/null
iptables -t mangle -N BW-OUT
iptables -t mangle -I POSTROUTING -o eth1 -j BW-OUT
# mark packets: 2 is active ftp and passive ftp, 1 is ACK for downloads 
and email and everything else
iptables -t mangle -A BW-OUT -p tcp -m length --length :64 -j MARK 
--set-mark 1
iptables -t mangle -A BW-OUT -p tcp -m length --length :64 -j RETURN
iptables -t mangle -A BW-OUT -m tcp -p tcp --dport 25 -j MARK --set-mark 2
iptables -t mangle -A BW-OUT -m tcp -p tcp --dport 25 -j RETURN
iptables -t mangle -A BW-OUT -p tcp --sport 59999 -j MARK --set-mark 3
iptables -t mangle -A BW-OUT -p tcp --sport 59999 -j RETURN
iptables -t mangle -A BW-OUT -p tcp --sport 50000:51000 -j MARK --set-mark 3
iptables -t mangle -A BW-OUT -p tcp --sport 50000:51000 -j RETURN

# clear the qdisc
tc qdisc del dev eth1 root

#add the root qdisk
tc qdisc add dev eth1 root handle 1: htb default 10

#add main rate limit class and 2 leafs
tc class add dev eth1 parent 1: classid 1:1 htb rate 105kbps ceil 105kbps
tc class add dev eth1 parent 1:1 classid 1:10 htb rate 45kbps ceil 
105kbps prio 0
tc class add dev eth1 parent 1:1 classid 1:11 htb rate 40kbps ceil 
105kbps prio 1
tc class add dev eth1 parent 1:1 classid 1:12 htb rate 20kbps ceil 
105kbps prio 2
#filter traffic into classes
tc filter add dev eth1 parent 1:0  prio 0 protocol ip handle 1 fw flowid 
1:10
tc filter add dev eth1 parent 1:0  prio 1 protocol ip handle 2 fw flowid 
1:11
tc filter add dev eth1 parent 1:0  prio 2 protocol ip handle 3 fw flowid 
1:12
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

                 reply	other threads:[~2006-03-05 20:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=440B4B07.8060005@cfl.rr.com \
    --to=nix4me@cfl.rr.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox