From: Stef Coene <stef.coene@docum.org>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] configuration + HTB: question
Date: Wed, 28 May 2003 12:23:58 +0000 [thread overview]
Message-ID: <marc-lartc-105421129231583@msgid-missing> (raw)
In-Reply-To: <marc-lartc-105394931721332@msgid-missing>
> Thanks Stef,
>
> Can you look at this, am i doing correct?
>
> tc qdisc del dev eth0 root
>
> # Add HTB root qdisc
> tc qdisc add dev eth0 root handle 1: htb
>
> # Add main 'local' rate class
> tc class add dev eth0 parent 1: classid 1:1 htb rate
> 60Mbit
>
> #add leaf classes(20 classes, one class for one ip in
> range 192.168.1.1 - 192.168.1.20)
> tc class add dev eth0 parent 1:1 classid 1:20 htb rate
> 32kbit ceil 60Mbit
> tc class add dev eth0 parent 1:1 classid 1:21 htb rate
> 32kbit ceil 60Mbit
> tc class add dev eth0 parent 1:1 classid 1:22 htb rate
> 32kbit ceil 60Mbit
> tc class add dev eth0 parent 1:1 classid 1:23 htb rate
> 32kbit ceil 60Mbit
> ...
> tc class add dev eth0 parent 1:1 classid 1:39 htb rate
> 32kbit ceil 60Mbit
>
> # attach qdisc to leaf classes
> tc qdisc add dev eth0 parent 1:20 handle 20: sfq
> tc qdisc add dev eth0 parent 1:21 handle 21: sfq
> tc qdisc add dev eth0 parent 1:22 handle 22: sfq
> tc qdisc add dev eth0 parent 1:23 handle 23: sfq
> ...
> tc qdisc add dev eth0 parent 1:39 handle 39: sfq
>
> # filter traffic into classes by fwmark
> tc filter add dev eth0 parent 1:0 protocol ip handle 1
> fw flowid 1:20
> tc filter add dev eth0 parent 1:0 protocol ip handle 2
> fw flowid 1:21
> tc filter add dev eth0 parent 1:0 protocol ip handle 3
> fw flowid 1:22
> tc filter add dev eth0 parent 1:0 protocol ip handle 4
> fw flowid 1:23
> ...
> tc filter add dev eth0 parent 1:0 protocol ip handle 1
> fw flowid 1:39
>
> # add fwmark entries
> iptables -t mangle -A OUTPUT -d 192.168.1.1 -j MARK
> --set-mark 1
> iptables -t mangle -A OUTPUT -d 192.168.1.2 -j MARK
> --set-mark 2
> iptables -t mangle -A OUTPUT -d 192.168.1.3 -j MARK
> --set-mark 3
> iptables -t mangle -A OUTPUT -d 192.168.1.4 -j MARK
> --set-mark 4
> ...
> iptables -t mangle -A OUTPUT -d 192.168.1.20 -j MARK
> --set-mark 39
>
>
> But if i want to add one more ip, for example
> 192.168.1.21, i need:
> 1) add leaf class
> 2) attach to it qdisc with sfq
> 3) add filter by fwmark
> 4) add one entry with iptables to mark ip 192.168.1.21
Indeed.
You can reduce the number of fw filters rules if you use the mark as hash key.
So if you add
tc filter add dev eth0 parent 1:0 protocol ip handle 1 fw
and you have a packet with mark 39, it will placed in class 1:39.
> Maybe i'm on wrong way or is it standard way for
> fairly dividing 60Mbit between users and what if i
> need to delete/add users dynamically?
> I'm newbie to this and your help is very, very
> appreciated
I think you implemented it like it should be. Each user a class.
Stef
--
stef.coene@docum.org
"Using Linux as bandwidth manager"
http://www.docum.org/
#lartc @ irc.oftc.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
prev parent reply other threads:[~2003-05-28 12:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-26 11:40 [LARTC] configuration + HTB: question Ruslan Spivak
2003-05-26 18:19 ` Stef Coene
2003-05-27 8:10 ` Ruslan Spivak
2003-05-28 12:23 ` Stef Coene [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-105421129231583@msgid-missing \
--to=stef.coene@docum.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 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.