* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
@ 2002-04-17 8:34 ` Martin Devera
2002-04-17 9:07 ` Alex Bennee
` (20 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-17 8:34 UTC (permalink / raw)
To: lartc
Hi,
I'm happy that HTB gained so much popularity ;) Only
one hint for you - you can completely avoid all these
tc filter add .... fw ...
You can use only one
tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1 fw
and set classid directly in iptables like:
iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
and so on ..
devik
On 17 Apr 2002, alex wrote:
> /sbin/iptables -t mangle -A to-dsl -p tcp --dport 22 -j MARK
> --set-mark 1
>
> /sbin/iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK
> --set-mark 2
>
> /sbin/tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1
> fw classid 1:10
> /sbin/tc filter add dev ppp0 parent 1: protocol ip prio 2 handle 2
> fw classid 1:20
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
2002-04-17 8:34 ` Martin Devera
@ 2002-04-17 9:07 ` Alex Bennee
2002-04-17 9:33 ` Martin Devera
` (19 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Alex Bennee @ 2002-04-17 9:07 UTC (permalink / raw)
To: lartc
Martin Devera said:
> Hi,
> I'm happy that HTB gained so much popularity ;) Only
> one hint for you - you can completely avoid all these
> tc filter add .... fw ...
> You can use only one
> tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1 fw
>
> and set classid directly in iptables like:
> iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
>
> and so on ..
> devik
Thanks for that it should make my script a bit less cumbersome. I have also
realised that at the moment the bandwidth is being shared out in proportion
to allocated bandwidths which is not quite what I was after. Having re-read
your manual pages I've now added "prio" statements to each htb class so
that if I'm downloading from inside I get all the bandwidth I need at the
expense of the uploads, rather tha a 2:1 split. I got it the second time,
the first time I wasn't sure if prio 0 was the highest or lowest priority.
The other thing that is current sub-optimal is the division of long uploads
vs short uploads. I've attempted to ensure that normal webpages are
downloaded as fast as possible with the burst parameter but if someone is
downloading a large file from my website all other web users suffer. I've
got to do some more reading but my current plan involves the iptable
connection tracking.
I'm not sure if iptables does this already but if I can match and tag a
packet based on the time of the connection I can still allow new
connections to get priority of long lived downloads. This may involve
writting a new kernel module as a netfilter extension but it would be the
iceing on the cake to my setup :-)
Alex
www.bennee.com/~alex/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
2002-04-17 8:34 ` Martin Devera
2002-04-17 9:07 ` Alex Bennee
@ 2002-04-17 9:33 ` Martin Devera
2002-04-17 12:46 ` Stef Coene
` (18 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-17 9:33 UTC (permalink / raw)
To: lartc
> The other thing that is current sub-optimal is the division of long uploads
> vs short uploads. I've attempted to ensure that normal webpages are
> downloaded as fast as possible with the burst parameter but if someone is
> downloading a large file from my website all other web users suffer. I've
> got to do some more reading but my current plan involves the iptable
> connection tracking.
>
> I'm not sure if iptables does this already but if I can match and tag a
> packet based on the time of the connection I can still allow new
> connections to get priority of long lived downloads. This may involve
> writting a new kernel module as a netfilter extension but it would be the
Hi I was already planing it ;) To add netfilter match to STATUS module
which would allow --conn-traffic from:to to select only connection whose
transfered bytes value is in given range.
Then you can have different classes for long and short downloads ..
devik
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (2 preceding siblings ...)
2002-04-17 9:33 ` Martin Devera
@ 2002-04-17 12:46 ` Stef Coene
2002-04-17 12:54 ` Martin Devera
` (17 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Stef Coene @ 2002-04-17 12:46 UTC (permalink / raw)
To: lartc
On Wednesday 17 April 2002 10:34, Martin Devera wrote:
> Hi,
> I'm happy that HTB gained so much popularity ;) Only
> one hint for you - you can completely avoid all these
> tc filter add .... fw ...
> You can use only one
> tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1 fw
>
> and set classid directly in iptables like:
> iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
>
> and so on ..
> devik
Thx.
Even I 'm learning from this list :)
But how do you translate xx:xx to HEX ?
Stef
>
> On 17 Apr 2002, alex wrote:
> > /sbin/iptables -t mangle -A to-dsl -p tcp --dport 22 -j MARK
> > --set-mark 1
> >
> > /sbin/iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK
> > --set-mark 2
> >
> > /sbin/tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1
> > fw classid 1:10
> > /sbin/tc filter add dev ppp0 parent 1: protocol ip prio 2 handle 2
> > fw classid 1:20
>
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
--
stef.coene@docum.org
"Using Linux as bandwidth manager"
http://www.docum.org/
#lartc @ irc.openprojects.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (3 preceding siblings ...)
2002-04-17 12:46 ` Stef Coene
@ 2002-04-17 12:54 ` Martin Devera
2002-04-17 13:10 ` Stef Coene
` (16 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-17 12:54 UTC (permalink / raw)
To: lartc
> > You can use only one
> > tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1 fw
> >
> > and set classid directly in iptables like:
> > iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> > iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
> >
> > and so on ..
> > devik
> Thx.
> Even I 'm learning from this list :)
> But how do you translate xx:xx to HEX ?
handle numbers in tc ARE in hex, so that:
... classid a23f:334d
can be written as --set-mark 0xa23f334d
devik
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (4 preceding siblings ...)
2002-04-17 12:54 ` Martin Devera
@ 2002-04-17 13:10 ` Stef Coene
2002-04-17 13:43 ` Alex Bennee
` (15 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Stef Coene @ 2002-04-17 13:10 UTC (permalink / raw)
To: lartc
> handle numbers in tc ARE in hex, so that:
>
> ... classid a23f:334d
>
> can be written as --set-mark 0xa23f334d
And handle 11:111 ?
Stef
--
stef.coene@docum.org
"Using Linux as bandwidth manager"
http://www.docum.org/
#lartc @ irc.openprojects.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (5 preceding siblings ...)
2002-04-17 13:10 ` Stef Coene
@ 2002-04-17 13:43 ` Alex Bennee
2002-04-17 13:46 ` Martin Devera
` (14 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Alex Bennee @ 2002-04-17 13:43 UTC (permalink / raw)
To: lartc
Stef Coene said:
>> handle numbers in tc ARE in hex, so that:
>>
>> ... classid a23f:334d
>>
>> can be written as --set-mark 0xa23f334d
> And handle 11:111 ?
would become --set-mark 0x00110111...
> Stef
>
> --
>
> stef.coene@docum.org
> "Using Linux as bandwidth manager"
> http://www.docum.org/
> #lartc @ irc.openprojects.net
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Alex
www.bennee.com/~alex/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (6 preceding siblings ...)
2002-04-17 13:43 ` Alex Bennee
@ 2002-04-17 13:46 ` Martin Devera
2002-04-17 13:50 ` Stef Coene
` (13 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-17 13:46 UTC (permalink / raw)
To: lartc
0x110111 Last 4 digits (16bits) is class, firct 16bit is qdisc.
On Wed, 17 Apr 2002, Stef Coene wrote:
> > handle numbers in tc ARE in hex, so that:
> >
> > ... classid a23f:334d
> >
> > can be written as --set-mark 0xa23f334d
> And handle 11:111 ?
>
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (7 preceding siblings ...)
2002-04-17 13:46 ` Martin Devera
@ 2002-04-17 13:50 ` Stef Coene
2002-04-17 15:57 ` Don Cohen
` (12 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Stef Coene @ 2002-04-17 13:50 UTC (permalink / raw)
To: lartc
> > And handle 11:111 ?
>
> would become --set-mark 0x00110111...
Or 0x011111?
mhh. So the hex number is splitted in 2 equal halves and the ":" is putted
in the middle ?
Stef
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (8 preceding siblings ...)
2002-04-17 13:50 ` Stef Coene
@ 2002-04-17 15:57 ` Don Cohen
2002-04-17 16:03 ` Martin Devera
` (11 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Don Cohen @ 2002-04-17 15:57 UTC (permalink / raw)
To: lartc
> From: Martin Devera <devik@cdi.cz>
> I'm happy that HTB gained so much popularity ;) Only
> one hint for you - you can completely avoid all these
> tc filter add .... fw ...
> You can use only one
> tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1 fw
>
> and set classid directly in iptables like:
> iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
>
> and so on ..
> devik
>
>
> On 17 Apr 2002, alex wrote:
>
> > /sbin/iptables -t mangle -A to-dsl -p tcp --dport 22 -j MARK
> > --set-mark 1
> >
> > /sbin/iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK
> > --set-mark 2
> >
> > /sbin/tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1
> > fw classid 1:10
> > /sbin/tc filter add dev ppp0 parent 1: protocol ip prio 2 handle 2
> > fw classid 1:20
Is this documented anywhere? How/why does it work?
I gather that the mark is interpreted as 16 bits of parent and 16 bits
of class. But you couldn't you also have said something like this?
iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
/sbin/tc filter add dev ppp0 parent 1: protocol ip prio 1
handle 10 fw classid 1:20
** ****
Would that just not work?
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (9 preceding siblings ...)
2002-04-17 15:57 ` Don Cohen
@ 2002-04-17 16:03 ` Martin Devera
2002-04-17 16:09 ` Martin Devera
` (10 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-17 16:03 UTC (permalink / raw)
To: lartc
exactly
On Wed, 17 Apr 2002, Stef Coene wrote:
> > > And handle 11:111 ?
> >
> > would become --set-mark 0x00110111...
> Or 0x011111?
>
> mhh. So the hex number is splitted in 2 equal halves and the ":" is putted
> in the middle ?
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (10 preceding siblings ...)
2002-04-17 16:03 ` Martin Devera
@ 2002-04-17 16:09 ` Martin Devera
2002-04-17 16:42 ` Jonas Lindqvist
` (9 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-17 16:09 UTC (permalink / raw)
To: lartc
> Is this documented anywhere? How/why does it work?
I don't think so (docs). But yes it is fw's feature. I found it
in cls_fw.c code - it is commented/described here.
> I gather that the mark is interpreted as 16 bits of parent and 16 bits
> of class. But you couldn't you also have said something like this?
> iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> /sbin/tc filter add dev ppp0 parent 1: protocol ip prio 1
> handle 10 fw classid 1:20
> ** ****
> Would that just not work?
No. The trick above works ONLY when mark = qdisc:classid AND fw filter
has NO children (no classid terms).
devik
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (11 preceding siblings ...)
2002-04-17 16:09 ` Martin Devera
@ 2002-04-17 16:42 ` Jonas Lindqvist
2002-04-17 21:25 ` Nils Lichtenfeld
` (8 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Jonas Lindqvist @ 2002-04-17 16:42 UTC (permalink / raw)
To: lartc
----- Original Message -----
From: "alex" <alex@bennee.com>
> # For outgoing packets we need to mark stuff
> /sbin/iptables -t mangle -A to-dsl -p tcp --dport 22 -j MARK
> --set-mark 1
>
> /sbin/iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK
> --set-mark 2
I'd also do like this:
iptables -t mangle -A to-dsl -p tcp --dport 22 -j MARK --set-mark 1
iptables -t mangle -A to-dsl -p tcp --dport 22 -j RETURN
iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 2
iptables -t mangle -A to-dsl -p tcp --dport 80 -j RETURN
etc...
Otherwise iptables will do the whole "to-dsl" list for every packet. In
your case ot wouldn't matter except for some extra CPU usage. But if you
would like to mark port 80 as bulk-traffic and ACK's as interactive
traffic, then those port 80 ACK's could be marked as bulk which you
wouldn't want it to.
Which brings me to another subject :) If your DSL-connection have
different bandwidth like 1mbit/128kbit then your download speed could be
destroyed by huge queues in your uplink.
I'd guess this would do the trick.
# Set ACK as prioritized traffic (ACK's are less than 100 bytes)
$IPTABLES -t mangle -A MANGLE_MARK -p tcp -m length --length :100 -j
MARK --set-mark 1
$IPTABLES -t mangle -A MANGLE_MARK -p tcp -m length --length :100 -j
RETURN
(You could probably mark ACK's with --tcp-flags SYN,FIN,RST ACK. But I
have not tested that yet.)
They also mention this here: http://lartc.org/wondershaper/
/Jonas
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (12 preceding siblings ...)
2002-04-17 16:42 ` Jonas Lindqvist
@ 2002-04-17 21:25 ` Nils Lichtenfeld
2002-04-17 21:27 ` Martin Devera
` (7 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Nils Lichtenfeld @ 2002-04-17 21:25 UTC (permalink / raw)
To: lartc
Hello there!
> I'd also do like this:
>
> iptables -t mangle -A to-dsl -p tcp --dport 22 -j MARK --set-mark 1
> iptables -t mangle -A to-dsl -p tcp --dport 22 -j RETURN
>
> iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 2
> iptables -t mangle -A to-dsl -p tcp --dport 80 -j RETURN
>
> etc...
>
> Otherwise iptables will do the whole "to-dsl" list for every packet. In
> your case ot wouldn't matter except for some extra CPU usage. But if you
> would like to mark port 80 as bulk-traffic and ACK's as interactive
> traffic, then those port 80 ACK's could be marked as bulk which you
> wouldn't want it to.
Does this behavior also occure when using ipchains?
Greetings Nils
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (13 preceding siblings ...)
2002-04-17 21:25 ` Nils Lichtenfeld
@ 2002-04-17 21:27 ` Martin Devera
2002-04-17 21:30 ` Nils Lichtenfeld
` (6 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-17 21:27 UTC (permalink / raw)
To: lartc
> > Otherwise iptables will do the whole "to-dsl" list for every packet. In
> > your case ot wouldn't matter except for some extra CPU usage. But if you
> > would like to mark port 80 as bulk-traffic and ACK's as interactive
> > traffic, then those port 80 ACK's could be marked as bulk which you
> > wouldn't want it to.
>
> Does this behavior also occure when using ipchains?
yes
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (14 preceding siblings ...)
2002-04-17 21:27 ` Martin Devera
@ 2002-04-17 21:30 ` Nils Lichtenfeld
2002-04-17 21:48 ` Nils Lichtenfeld
` (5 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Nils Lichtenfeld @ 2002-04-17 21:30 UTC (permalink / raw)
To: lartc
Hi there!
> I'm happy that HTB gained so much popularity ;)
Oh yes, its realy popular already, not only among people who now a lot about
linux, they just don't know they are using it. -> www.fli4l.de
> Only one hint for you - you can completely avoid all these
> tc filter add .... fw ...
> You can use only one
> tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1 fw
>
> and set classid directly in iptables like:
> iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
Is this also possible with the -m option in ipchains?
Greetings Nils
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (15 preceding siblings ...)
2002-04-17 21:30 ` Nils Lichtenfeld
@ 2002-04-17 21:48 ` Nils Lichtenfeld
2002-04-19 8:32 ` Martin Devera
` (4 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Nils Lichtenfeld @ 2002-04-17 21:48 UTC (permalink / raw)
To: lartc
Hello again!
> Only one hint for you - you can completely avoid all these
> tc filter add .... fw ...
> You can use only one
> tc filter add dev ppp0 parent 1: protocol ip prio 1 handle 1 fw
>
> and set classid directly in iptables like:
> iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
Oh an and I forgot to ask: Is there any other improvement exept for having a
shorter script?
Greetings Nils
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (16 preceding siblings ...)
2002-04-17 21:48 ` Nils Lichtenfeld
@ 2002-04-19 8:32 ` Martin Devera
2002-04-26 13:31 ` Nils Lichtenfeld
` (3 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-19 8:32 UTC (permalink / raw)
To: lartc
> > and set classid directly in iptables like:
> > iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> > iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
>
> Oh an and I forgot to ask: Is there any other improvement exept for having a
> shorter script?
It is a bit faster and simpler to maintain.
devik
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (17 preceding siblings ...)
2002-04-19 8:32 ` Martin Devera
@ 2002-04-26 13:31 ` Nils Lichtenfeld
2002-04-26 14:43 ` Martin Devera
` (2 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Nils Lichtenfeld @ 2002-04-26 13:31 UTC (permalink / raw)
To: lartc
Hello Devik!
> > > and set classid directly in iptables like:
> > > iptables -t mangle -A to-dsl -p tcp --dport 80 -j MARK --set-mark 0x10010
> > > iptables -t mangle -A to-dsl -p tcp --sport 24 -j MARK --set-mark 0x10020
> >
> > Oh an and I forgot to ask: Is there any other improvement exept for having a
> > shorter script?
>
> It is a bit faster and simpler to maintain.
We are using Ipchains. I guess that makes no difference. At the moment we do the
following:
For Example (all rules for the same device):
1. filter ACKs by using u32
2. filter a specific IP by using ipchains -m (because we masquarade) with its
own tc fw
3. filter ToS by using u32
4. filter by another IP with ipchains -m with its own tc fw
With only one tc fw per device (and using 8bit values with ipchains -m to
specifie the targetclass) i guess the order like shown above could not be
maintained. It would look like
2. 4. 1. 3. or 1. 2. 4. 3. depending on the positon of the tc fw filter. The
same order like in the example can not be achieved. Am I right with that
assumption?
Is it possible to have more than one of these "global" tc fw filters for one
device?
Greetings Nils
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (18 preceding siblings ...)
2002-04-26 13:31 ` Nils Lichtenfeld
@ 2002-04-26 14:43 ` Martin Devera
2002-04-27 16:05 ` Nils Lichtenfeld
2002-04-27 16:06 ` Martin Devera
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-26 14:43 UTC (permalink / raw)
To: lartc
> We are using Ipchains. I guess that makes no difference. At the moment we do the
> following:
>
> For Example (all rules for the same device):
> 1. filter ACKs by using u32
> 2. filter a specific IP by using ipchains -m (because we masquarade) with its
> own tc fw
> 3. filter ToS by using u32
> 4. filter by another IP with ipchains -m with its own tc fw
>
> With only one tc fw per device (and using 8bit values with ipchains -m to
> specifie the targetclass) i guess the order like shown above could not be
> maintained. It would look like
>
> 2. 4. 1. 3. or 1. 2. 4. 3. depending on the positon of the tc fw filter. The
> same order like in the example can not be achieved. Am I right with that
> assumption?
unfortunately, you are right
> Is it possible to have more than one of these "global" tc fw filters for one
> device?
probapbly yes but the first one will match all. But you can filter acks
with ipchains too (-y).
devik
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (19 preceding siblings ...)
2002-04-26 14:43 ` Martin Devera
@ 2002-04-27 16:05 ` Nils Lichtenfeld
2002-04-27 16:06 ` Martin Devera
21 siblings, 0 replies; 23+ messages in thread
From: Nils Lichtenfeld @ 2002-04-27 16:05 UTC (permalink / raw)
To: lartc
Hello Devik!
> But you can filter acks
> with ipchains too (-y).
Uh can I? I thought -y is for matching SYN-Packets.
Greetings Nils
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [LARTC] A tc htb/iptables rate control script for ADSL
2002-04-16 23:50 [LARTC] A tc htb/iptables rate control script for ADSL alex
` (20 preceding siblings ...)
2002-04-27 16:05 ` Nils Lichtenfeld
@ 2002-04-27 16:06 ` Martin Devera
21 siblings, 0 replies; 23+ messages in thread
From: Martin Devera @ 2002-04-27 16:06 UTC (permalink / raw)
To: lartc
Errr my mistake ... Yes SYN not ACK, sorry.
On Sat, 27 Apr 2002, Nils Lichtenfeld wrote:
> Hello Devik!
>
> > But you can filter acks
> > with ipchains too (-y).
>
> Uh can I? I thought -y is for matching SYN-Packets.
>
> Greetings Nils
>
>
>
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 23+ messages in thread