From: mdew <mdew@mdew.dyndns.org>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] How to limit bandwidth by port?
Date: Fri, 03 Jan 2003 06:51:58 +0000 [thread overview]
Message-ID: <marc-lartc-104157681315822@msgid-missing> (raw)
In-Reply-To: <marc-lartc-103972758027709@msgid-missing>
[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]
On Sat, 2002-12-14 at 03:57, Andrea Rossato wrote:
> DOWNLINK=220
> UPLINK=125
> DEV=ppp0
>
> tc qdisc add dev $DEV root handle 1: htb default 10
>
> tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6
>
> tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
> ceil $[UPLINK}kbit burst 6k prio 1
>
> tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[3*$UPLINK/10]kbit\
> ceil $[9*$UPLINK/10]kbit burst 6k prio 2
>
> tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
> tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
>
> tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
> match ip dport 8080 0xffff flowid 1:20
>
>
> traffic to dport 80 will get 3/10 of bandwith (with possibility to
> borrow up to 9/10)
> andrea
Andrea,
I have another script (attached) Im just wondering how i could implement
the above script into it. Im not the most knowledgable on shaping in
general :)
thanks
-mdew (resent-again)
[-- Attachment #2: shaping --]
[-- Type: text/x-sh, Size: 2440 bytes --]
#! /bin/sh
EXT_IFACE=eth0
modprobe imq numdevs=1
# del the qdisc already loaded (if there)
tc qdisc del dev imq0 root
tc qdisc add dev imq0 handle 1: root htb default 12 r2q 1
# [ HTB queue ]
# |
# |
# [256] (class 1:1)
# / | \
# / | \
# / | \
# / | \
# / | \
# [64] [64] [128] (note: these add up the the parent's 256)
# (1:10) (1:11) (1:12)
# | | |
# | | |
# [sfq] [sfq] [sfq]
# (20:0) (21:0) (22:0)
# The main link: 252kbit (less is better)
tc class add dev imq0 parent 1: classid 1:1 htb rate 254kbit
# For 10.0.0.9 - 64kbit all to itself - Paul
tc class add dev imq0 parent 1:1 classid 1:10 htb rate 20kbit burst 1kbit prio 1 ceil 36kbit
# For 10.0.0.2 - 64kbit all to itself - Mark
tc class add dev imq0 parent 1:1 classid 1:11 htb rate 20kbit burst 1kbit prio 1 ceil 60kbit
# For 10.0.0.3 and 10.0.0.8 - 128kbit between them - Ryan - Mike
tc class add dev imq0 parent 1:1 classid 1:12 htb rate 200kbit burst 10kbit prio 1 ceil 252kb
it
# SFQ makes things a bit fairer (in theory)
tc qdisc add dev imq0 parent 1:10 handle 20:0 sfq
tc qdisc add dev imq0 parent 1:11 handle 21:0 sfq
tc qdisc add dev imq0 parent 1:12 handle 22:0 sfq
# Match iptables mark 1 and send to class 1:10 (64kbit A)
tc filter add dev imq0 protocol ip pref 1 parent 1: handle 1 fw classid 1:10
# Match iptables mark 2 and send to class 1:11 (64kbit B)
tc filter add dev imq0 protocol ip pref 2 parent 1: handle 2 fw classid 1:11
# Match iptables mark 3 and send to class 1:12 (128kbit)
tc filter add dev imq0 protocol ip pref 3 parent 1: handle 3 fw classid 1:12
# The IMQ device must be up before this will work...
# ip link set imq0 up (set below)
iptables -t mangle -F
iptables -t mangle -X
iptables -t mangle -N incoming
iptables -t mangle -A incoming -d 10.0.0.9 -j MARK --set-mark 1
iptables -t mangle -A incoming -d 10.0.0.2 -j MARK --set-mark 2
iptables -t mangle -A incoming -m mark --mark 1 -j RETURN
iptables -t mangle -A incoming -m mark --mark 2 -j RETURN
iptables -t mangle -A incoming -j MARK --set-mark 3
iptables -t mangle -A FORWARD -i $EXT_IFACE -j incoming
iptables -t mangle -A FORWARD -i $EXT_IFACE -j IMQ
ip link set imq0 up
tc -s -d class show dev imq0
prev parent reply other threads:[~2003-01-03 6:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-12 21:11 [LARTC] How to limit bandwidth by port? David Coello
2002-12-13 14:57 ` Andrea Rossato
2003-01-03 6:51 ` mdew [this message]
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=marc-lartc-104157681315822@msgid-missing \
--to=mdew@mdew.dyndns.org \
--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