All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Alexandru Dragoi <waruiinu@gmail.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Htb, imq and sfq traffic shaping
Date: Mon, 24 Jan 2005 17:26:24 +0000	[thread overview]
Message-ID: <3063e505012409264f31331d@mail.gmail.com> (raw)
In-Reply-To: <20050124150857.7d530d34@drak.aard.net>

I didn't look much on your script (my brain is not that good
compiler), but looking at yoour default classes and what is happening
with you, i think the filters are not working on you, and evetything
go to default classes. If so, removing the default classes will make
everything work at maximum speed.


On Mon, 24 Jan 2005 15:08:57 +0100, Ixen Gerthannes <ixen2@o2.pl> wrote:
> Hello,
> I wrote a simple traffic shaping script (below) that should have allowed me to shape my internet traffic a bit (ppp0 - adsl 128kbit/64kbit; local interface eth0).
> The script works only partially - the speed is being limited but too much. Without running this script my download rate is about 10kBytes (with second computer also downloading at about 6kBytes). After running it my download speed decreases to about 1..2kBytes and so the second computer.
> Could you tell me what have I done wrong ?
> 
> Thank you for replies.
> Ixen
> 
> --------------
> My configuration:
> Celeron 450MHz, 256MB RAM
> Kernel 2.6.9 patched for imq support (imq devices compiled into kernel)
> iptables 1.2.11 (also patched for imq)
> 
> Script:
> #!/bin/sh
> 
> DOWNIF='imq0'
> UPIF='imq1'
> rc_done="  done"
> rc_failed="  failed"
> 
> TC='/sbin/tc'
> IPTABLES='/usr/sbin/iptables'
> IFCONFIG='/sbin/ifconfig'
> MODPROBE='/sbin/modprobe'
> 
> return=$rc_done
> 
> tc_reset ()
> {
>     # remove old devices if any
>     echo "Removing old root qdisc..."
>     $TC qdisc del dev $DOWNIF root
>     $TC qdisc del dev $UPIF root
> }
> 
> tc_status ()
> {
>     echo "===================="
>     echo "[qdisc - $DOWNIF]"
>     $TC -s qdisc show dev $DOWNIF
>     echo "[qdisc - $UPIF]"
>     $TC -s qdisc show dev $UPIF
>     echo "----------------------------------------"
>     echo
>     echo "[class - $DOWNIF]"
>     $TC -s class show dev $DOWNIF
>     echo "[class - $UPIF]"
>     $TC -s class show dev $UPIF
> }
> 
> tc_showfilter ()
> {
>     echo "[filter - $DOWNIF]"
>     $TC -s filter show dev $DOWNIF
>     echo "[filter - $UPIF]"
>     $TC -s filter show dev $UPIF
> }
> 
> case "$1" in
> 
> start)
>     echo "Starting traffic shaping..."
>     tc_reset
> 
>     # setup imq devices - imq0 for download, imq1 for upload
> #    $MODPROBE imq numdevs 2
> 
>     $IFCONFIG imq0 up
>     $IFCONFIG imq1 up
> 
>     # ROOT DEVICE
>     echo "      Setting root devices for $DOWNIF and $UPIF"
> 
>     # download
>     $TC qdisc add dev $DOWNIF root handle 1: htb default 99
>     $TC qdisc add dev $DOWNIF parent 1: classid 1:10 htb rate 128kbit
>     # upload
>     $TC qdisc add dev $UPIF root handle 1: htb default 98
>     $TC class add dev $UPIF parent 1: classid 1:20 htb rate 64kbit
> 
>     # ADDRESSES
>     echo "      192.168.0.30"
>     # 192.168.0.30
>     $TC class add dev $DOWNIF parent 1:10 classid 1:1000 htb rate 48kbit ceil 128kbit
>     $TC qdisc add dev $DOWNIF parent 1:1000 handle 1000 sfq
>     $TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1000 fw classid 1:1000
> 
>     $TC class add dev $UPIF parent 1:20 classid 1:2000 htb rate 24kbit ceil 64kbit
>     $TC qdisc add dev $UPIF parent 1:2000 handle 2000 sfq
>     $TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2000 fw classid 1:2000
> 
>     $IPTABLES -t mangle -A POSTROUTING -d 192.168.0.30 -j MARK --set-mark 1000
>     $IPTABLES -t mangle -A POSTROUTING -s 192.168.0.30 -j MARK --set-mark 2000
> 
>     # 192.168.0.178
>     echo "      192.168.0.178"
>     $TC class add dev $DOWNIF parent 1:10 classid 1:1010 htb rate 16kbit ceil 100kbit
>     $TC qdisc add dev $DOWNIF parent 1:1010 handle 1010 sfq
>     $TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1010 fw classid 1:1010
> 
>     $TC class add dev $UPIF parent 1:20 classid 1:2010 htb rate 8kbit ceil 60kbit
>     $TC qdisc add dev $UPIF parent 1:2010 handle 2010 sfq
>     $TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2010 fw classid 1:2010
> 
>     $IPTABLES -t mangle -A POSTROUTING -d 192.168.0.178 -j MARK --set-mark 1010
>     $IPTABLES -t mangle -A POSTROUTING -s 192.168.0.178 -j MARK --set-mark 2010
> 
>     # 192.168.0.55
>     echo "      192.168.0.55"
>     $TC class add dev $DOWNIF parent 1:10 classid 1:1020 htb rate 16kbit ceil 100kbit
>     $TC qdisc add dev $DOWNIF parent 1:1020 handle 1020 sfq
>     $TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1020 fw classid 1:1020
> 
>     $TC class add dev $UPIF parent 1:20 classid 1:2020 htb rate 8kbit ceil 60kbit
>     $TC qdisc add dev $UPIF parent 1:2020 handle 2020 sfq
>     $TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2020 fw classid 1:2020
> 
>     $IPTABLES -t mangle -A POSTROUTING -d 192.168.0.55 -j MARK --set-mark 1020
>     $IPTABLES -t mangle -A POSTROUTING -s 192.168.0.55 -j MARK --set-mark 2020
> 
>     # other
>     echo "      other..."
>     $TC class add dev $DOWNIF parent 1:10 classid 1:99 htb rate 100bit ceil 8kbit
>     $TC class add dev $UPIF parent 1:20 classid 1:98 htb rate 100bit ceil 8kbit
> 
>     # route traffic
>     echo "      Traffic redirecting"
>     # download
>     $IPTABLES -t mangle -A POSTROUTING -d 192.168.0.0/24 -j IMQ --todev 0
>     #upload
>     $IPTABLES -t mangle -A POSTROUTING -s 192.168.0.0/24 -j IMQ --todev 1
> 
>     tc_status
> ;;
> 
> stop)
>     echo -n "Stopping traffic shaper..."
>     tc_reset || return=$rc_failed
>     echo -e "$return"
> ;;
> 
> restart|reload)
>     $0 stop && $0 start || return=$rc_failed
> ;;
> 
> stats|status)
>     tc_status
> ;;
> 
> filter)
>     tc_showfilter
> ;;
> 
> *)
>     echo "Usage: $0 {start|stop|restart|stats|filter}"
> esac
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 


-- 
Bla bla
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  reply	other threads:[~2005-01-24 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-24 14:08 [LARTC] Htb, imq and sfq traffic shaping Ixen Gerthannes
2005-01-24 17:26 ` George Alexandru Dragoi [this message]
2005-01-25 12:23 ` Andy Furniss
2005-01-26 16:18 ` Andre Correa

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=3063e505012409264f31331d@mail.gmail.com \
    --to=waruiinu@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.