From: "Alex" <alex@hostingcenter.ro>
To: lartc@vger.kernel.org
Subject: [LARTC] Re: HTB and metro+int. limits
Date: Tue, 30 Sep 2003 19:27:19 +0000 [thread overview]
Message-ID: <marc-lartc-106495028017660@msgid-missing> (raw)
Thanks for your replay, it really helps, but to take the question further,
from what you have seen in my sample script, how should I classify packets
with "tc" ? I don't know how to put them in separate classes,. What I have
in my script will only shape metro traffic, but for international how would
the "tc" command be?
Something like:
/sbin/tc class add dev eth2 parent 1:2 classid 2:11 htb rate 50kbit ceil
100kbit prio 5
/sbin/tc filter add dev eth2 parent 1:0 protocol ip prio 5 u32 match ip dst
192.168.254.10 flowid 1:11
Would this be the correct commands?
Thanks again.
Alex
---begin my script----
sbin/tc qdisc add dev eth2 root handle 1: htb default 10
/sbin/tc class add dev eth2 parent 1: classid 1:1 htb rate 10M
#metro
/sbin/tc class add dev eth2 parent 1:1 classid 1:10 htb rate 10M
/sbin/tc filter add dev eth2 protocol ip parent 1:10 prio 3 handle 6 flowid
1:10
#international
/sbin/tc class add dev eth2 parent 1:1 classid 1:2 htb rate 10M
/sbin/tc filter add dev eth2 protocol ip parent 1:10 prio 3 handle 5 flowid
1:2
/sbin/tc class add dev eth2 parent 1:1 classid 1:11 htb rate 50kbit ceil
100kbit prio 5
/sbin/tc filter add dev eth2 parent 1:0 protocol ip prio 5 u32 match ip dst
192.168.254.10 flowid 1:11
/sbin/tc class add dev eth2 parent 1:1 classid 1:12 htb rate 50kbit ceil
100kbit prio 5
/sbin/tc filter add dev eth2 parent 1:0 protocol ip prio 5 u32 match ip dst
192.168.254.11 flowid 1:12
....etc
--end--
----- Original Message -----
From: <cmulcahy@avesi.com>
To: "Alex" <alex@hostingcenter.ro>
Sent: Tuesday, September 30, 2003 9:07 PM
Subject: Re: HTB and metro+int. limits
> Alex
>
> Alex writes:
>
> > Hello,
> > I need to setup HTB to limit the bandwidth, but I need to have 2 types
of
> > limits, because my ISP gives me more bandwith for sites located in my
> > country, than others located outside. I have setup the following script
in
> > which I mark packets with mark 6 for the ip clasess for the sites in my
> > country. What I don't know is how to continue the script with assigning
> > lower limits to everything else not going from ip's in --set-mark 6.
> > Maybe some of can enlighten me about this.
> > Thanks,
> >
> > Alex
> >
> <snip>
> ......
> > /sbin/iptables -t mangle -A PREROUTING -i eth2 -d 193.231.15.0/24 -j
> > MARK --set-mark 6
> > #end metro
> > #
> > #2. Anything else
> > /sbin/iptables -t mangle -A PREROUTING -i eth2 -d 0/0 -j MARK --set-mark
5
>
> </snip>
>
> This will not differentiate your traffic. Everything "-i eth2" will end
up
> marked '5' because iptables will evaluate against every rule in order,
> eventually marking them '5' whether they have previously been marked '6'
or
> not.
>
> You need to create a new table with two commands for each address range.
> ie:
>
> /sbin/iptables -t mangle -N MYMARKER
> /sbin/iptables -t mangle -A PREROUTING -i eth2 -j MYMARKER
>
> # and ...
> /sbin/iptables -t mangle -A MYMARKER -d 193.231.15.0/24 -j MARK --set-mark
6
> /sbin/iptables -t mangle -A MYMARKER -d 193.231.15.0/24 -j RETURN
> # for each metro range, and finally ....
> /sbin/iptables -t mangle -A MYMARKER -j MARK --set-mark 5
> /sbin/iptables -t mangle -A MYMARKER -j RETURN
>
> The separate table and the 'RETURN' statements give you the
"short-circuit"
> evaluation you require.
>
> BTW: You might be able to consolidate your metro class-C's into fewer
> (larger) CIDR ranges to speed evaluation. ( Your upstream provider has
> likely been allocated them in this manner )
>
> mulc
>
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
next reply other threads:[~2003-09-30 19:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-30 19:27 Alex [this message]
2003-10-01 9:59 ` [LARTC] Re: HTB and metro+int. limits Stef Coene
2003-10-01 16:00 ` Alex
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-106495028017660@msgid-missing \
--to=alex@hostingcenter.ro \
--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.