Re: [LARTC] HTB problem running on VLAN, not working

2005-10-08 Thread Andy Furniss

Samuel Koscelansky / "SUBNET" wrote:

I tested shaping on vlan and it seems OK for me (even though my switch 
doesn't do vlan it doesn't seem to block oversize frames). I noticed a 
few things with your setup -




#classes for download
/sbin/tc class add dev eth0.100 parent 100: classid 100:1 htb rate 4000kbit 
quantum 6000

/sbin/tc class add dev eth0.100 parent 100:1 classid 100:2 htb rate 1000kbit 
quantum 6000
/sbin/tc qdisc add dev eth0.100 parent 100:2 handle 1002 pfifo limit 10


You attach pfifo as if 100:2 is a leaf class here



#my pc testing class
#down
/sbin/tc class add dev eth0.100 parent 100:2 classid 100:2828 htb rate 1000kbit 
quantum 6000
/sbin/tc filter add dev eth0.100 parent 100: protocol ip prio 1 u32 match ip 
dst 217.67.28.28 classid 100:2828
/sbin/tc qdisc add dev eth0.100 parent 100:2828 handle 1002828 sfq perturb 10


But have it as a parent here, also I think the handle on sfq is too big 
and if eth0.100 is to your ISP then dst should be changed src in the match.


Andy.

___
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-31 Thread Andy Furniss
Andy Furniss wrote:
Saying that I did notice that HTB was dropping - 
maybe the default queue length is shorter now? It does seem a bit 
strange though, I see drops where I expect the queue to be long enough 
for my rwin and a class with two tcps on the go had less drops than one 
with one - strange.
I took another look at this and it's because the default queue length of 
the default class is shorter than the default for a normal class.

Andy.
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-29 Thread Andy Furniss
Andy Furniss wrote:
 1 
$TC class add dev imq0 parent 1:1 classid 1:32 htb rate 133kbit ceil 
400kbit prio 1
I meant to delete the prio 1 - I don't know if it matters  - I tested 
with the other two.

Andy.
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-29 Thread Andy Furniss
Leslie Patrick Polzer wrote:
Still problems :(
I upgraded to kernel 2.6.9 now, configured IMQ to hook itself up after 
NAT, called it
from prerouting, used u32 (matching works), set the root class to a rate 
of 800kBit
(which is 200 less than my link speed) - and the behavior gets even 
worse :(

Unfortunately, I cannot shape on the outgoing interfaces either, because 
there are two.

I really don't know what to do now... I haven't dug deep into CBQ yet - 
should I try it?
Hmm - this should work. I just cobbled together a test - It's not very 
elegant because it's based on a slightly different setup, but it works 
for me. I use default as my local traffic has a dynamic IP - you don't 
need to . Note the U32 filters are attached to 1:0 if I attached them to 
1:1 than I would need a rule to send traffic to 1:1.

I wouldn't trust the output of apps for bandwidth tests - their 
averaging can be confusing - also if it weren't just a test I would add 
queues to the classes. Saying that I did notice that HTB was dropping - 
maybe the default queue length is shorter now? It does seem a bit 
strange though, I see drops where I expect the queue to be long enough 
for my rwin and a class with two tcps on the go had less drops than one 
with one - strange.

It did work though use tc -s class ls dev imq0 to see rates (which for 
me using the new TC seem to be shown in the wrong units).

You may need to unwrap the lines if you copy n paste this:
set -x
IPTABLES=/usr/local/sbin/iptables
MODPROBE=/sbin/modprobe
IP=/sbin/ip
TC=/sbin/tc
$IPTABLES -t mangle -D PREROUTING -i ppp0 -j IMQ --todev 0 &> /dev/null
$IP link set imq0 down &> /dev/null
$MODPROBE -r imq &> /dev/null
if [ "$1" = "stop" ]
then
echo "stopping"
exit
fi
$MODPROBE imq numdevs=1
$IPTABLES -t mangle -I PREROUTING -i ppp0 -j IMQ --todev 0
$IP link set imq0 up
$TC qdisc add dev imq0 root handle 1:0 htb default 34
$TC class add dev imq0 parent 1:0 classid 1:1 htb rate 400kbit ceil 
400kbit burst 6k

 1 
$TC class add dev imq0 parent 1:1 classid 1:32 htb rate 133kbit ceil 
400kbit prio 1

$TC filter add dev imq0 protocol ip parent 1:0 prio 1 u32 match ip dst 
192.168.0.2 flowid 1:32

 2 
$TC class add dev imq0 parent 1:1 classid 1:33 htb rate 133kbit ceil 400kbit
$TC filter add dev imq0 protocol ip parent 1:0 prio 1 u32 match ip dst 
192.168.0.3 flowid 1:33

 Default = traffic for local process 
$TC class add dev imq0 parent 1:1 classid 1:34 htb rate 133kbit ceil 400kbit

Andy.

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-29 Thread Francisco Pereira
Quoting Leslie Patrick Polzer <[EMAIL PROTECTED]>:

> Still problems :(
> 
> I upgraded to kernel 2.6.9 now, configured IMQ to hook itself up after 
> NAT, called it
> from prerouting, used u32 (matching works), set the root class to a rate 
> of 800kBit
> (which is 200 less than my link speed) - and the behavior gets even worse :(
> 
> Unfortunately, I cannot shape on the outgoing interfaces either, because 
> there are two.

Have you tried putting another machine as a bridge? (You dont need the IMQ in
this case)


-
Elecciones Nacionales 2004
Consulte en el Portal donde votar
http://www.montevideo.com.uy/elecciones2004
-

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-29 Thread Jason Boxman
On Friday 29 October 2004 11:36, Leslie Patrick Polzer wrote:
> Still problems :(
>
> I upgraded to kernel 2.6.9 now, configured IMQ to hook itself up after
> NAT, called it
> from prerouting, used u32 (matching works), set the root class to a rate
> of 800kBit
> (which is 200 less than my link speed) - and the behavior gets even worse
> :(

Define worse?  What metric are you using to measure the behavior?

> Unfortunately, I cannot shape on the outgoing interfaces either, because
> there are two.

Wouldn't IMQ work for this too?

> I really don't know what to do now... I haven't dug deep into CBQ yet -
> should I try it?

CBQ won't magically work over multiple interfaces without something like IMQ, 
just like HTB.

-- 

Jason Boxman
Perl Programmer / *NIX Systems Administrator
Shimberg Center for Affordable Housing | University of Florida
http://edseek.com/ - Linux and FOSS stuff

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-29 Thread Leslie Patrick Polzer
Still problems :(
I upgraded to kernel 2.6.9 now, configured IMQ to hook itself up after 
NAT, called it
from prerouting, used u32 (matching works), set the root class to a rate 
of 800kBit
(which is 200 less than my link speed) - and the behavior gets even worse :(

Unfortunately, I cannot shape on the outgoing interfaces either, because 
there are two.

I really don't know what to do now... I haven't dug deep into CBQ yet - 
should I try it?

Leslie
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-29 Thread Andy Furniss
Leslie Patrick Polzer wrote:
Andy Furniss wrote:
Leslie Patrick Polzer wrote:
Hello,
I have a serious problem with HTB which I wasn't able to solve myself.
I run a masquerading router with ppp0 as interface to the Internet.
Three clients need to share a downstream of 1 MBit, which I want
to divide with tc.
When I see a packet being forwarded to one of these clients, I give
it the appropriate unique mark:
iptables -t mangle -A FORWARD -d 192.168.34.141 -j MARK --set-mark 1
iptables -t mangle -A FORWARD -d 192.168.34.140 -j MARK --set-mark 2
iptables -t mangle -A FORWARD -d 192.168.1.2 -j MARK --set-mark 3
Because it might be of interest: 192.168.34.0/24 is on network A
with 10 MBit, 192.168.1.0/24 is on network B with 100 MBit.
I then attach an IMQ device imq0 to the FORWARD table:

You can't use IMQ in forward AFAIK, see
http://www.docum.org/docum.org/kptd/

Hmmm, really?
I mean, all intended packets are going through it, no errors
whatsoever. They are being marked correctly by iptables
and tc filter classifies according to mark. The only problem
seems to be the excess bandwidth distribution, which
leaves me to the question:
How could the hooks of IMQ and the excess bandwidth
distribution of HTB relate in this setup?
I hope you are understanding that I do not question your
knowledge. I'm just not fully persuaded of this yet, so I'd
like to discuss it a bit more.
You are right to question me :-) - I was thinking a bit too much about 
my setup (At least I know that works). I use IMQ on ppp so I can shape 
traffic headed for local processes as well as forwarded. If you don't 
need to do this then you don't need to do it in prerouting anyway.

I am guessing that calling IMQ from forward uses postrouting which is OK 
for your needs. I know from a test I did in prerouting that IMQ doesn't 
respect where in a table it gets called from. You could test by seeing 
if you can shape locally generated traffic marked in output I suppose.

Wherever it hooks you need to set a rate less than link speed and if you 
use an old kernel, patch HTB. I said shaping from the wrong end of the 
bottleneck is a kludge because if I shape from the fat end then I 
control exactly what happens - I can arrange for my latency never to be 
increased by more than the time it takes for a packet my MTU long to be 
sent at my bitrate. As long as I tweak for link overheads I can use 
nearly 100% bandwidth.

Incoming traffic from my ISP has already been through a 600ms fifo - 
it's never going to arrive at more than my link speed, so I need to set 
the ceils/rate totals to less than link speed - how much less will 
determine how fast the queue fills. The behavior of various types of 
queues is probably not the same as if they were at the other end of the 
bottleneck.

There are also factors out of my control - TCP can get bursty when acks 
get buffered elsewhere. There may be packets in long buffers (mainly 
P2P) headed for me which are unstoppable, and my queue may not have any 
packets from active connections at any given time. The queue also reacts 
 too late when the bandwidth changes - A new connection will be in TCP 
slowstart, which quite quickly will increase rate causing a temporary 
filling of ISP buffer - which hurts latency. It doesn't fill enough to 
cause drops, though, so as far as bandwidth allocation goes it's OK.
My queues also drop a bit too much when this happens - causing TCP to 
resync which can be bursty.

Andy.

And thanks a lot for the additional information you gave me!
Kind regards,
Leslie


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-29 Thread Leslie Patrick Polzer
Andy Furniss wrote:
Shaping from the narrow end of the bottleneck is a bit of a kludge, 
you have to set your rates/ceils lower than link speed or you won't 
have a queue to shape with.

Could you also elaborate this a bit further?
Many thanks so far!
Leslie
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-28 Thread Leslie Patrick Polzer
Andy Furniss wrote:
Leslie Patrick Polzer wrote:
Hello,
I have a serious problem with HTB which I wasn't able to solve myself.
I run a masquerading router with ppp0 as interface to the Internet.
Three clients need to share a downstream of 1 MBit, which I want
to divide with tc.
When I see a packet being forwarded to one of these clients, I give
it the appropriate unique mark:
iptables -t mangle -A FORWARD -d 192.168.34.141 -j MARK --set-mark 1
iptables -t mangle -A FORWARD -d 192.168.34.140 -j MARK --set-mark 2
iptables -t mangle -A FORWARD -d 192.168.1.2 -j MARK --set-mark 3
Because it might be of interest: 192.168.34.0/24 is on network A
with 10 MBit, 192.168.1.0/24 is on network B with 100 MBit.
I then attach an IMQ device imq0 to the FORWARD table:

You can't use IMQ in forward AFAIK, see
http://www.docum.org/docum.org/kptd/
Hmmm, really?
I mean, all intended packets are going through it, no errors
whatsoever. They are being marked correctly by iptables
and tc filter classifies according to mark. The only problem
seems to be the excess bandwidth distribution, which
leaves me to the question:
How could the hooks of IMQ and the excess bandwidth
distribution of HTB relate in this setup?
I hope you are understanding that I do not question your
knowledge. I'm just not fully persuaded of this yet, so I'd
like to discuss it a bit more.
And thanks a lot for the additional information you gave me!
Kind regards,
Leslie
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-28 Thread Andy Furniss
Leslie Patrick Polzer wrote:
Hello,
I have a serious problem with HTB which I wasn't able to solve myself.
I run a masquerading router with ppp0 as interface to the Internet.
Three clients need to share a downstream of 1 MBit, which I want
to divide with tc.
When I see a packet being forwarded to one of these clients, I give
it the appropriate unique mark:
iptables -t mangle -A FORWARD -d 192.168.34.141 -j MARK --set-mark 1
iptables -t mangle -A FORWARD -d 192.168.34.140 -j MARK --set-mark 2
iptables -t mangle -A FORWARD -d 192.168.1.2 -j MARK --set-mark 3
Because it might be of interest: 192.168.34.0/24 is on network A
with 10 MBit, 192.168.1.0/24 is on network B with 100 MBit.
I then attach an IMQ device imq0 to the FORWARD table:
You can't use IMQ in forward AFAIK, see
http://www.docum.org/docum.org/kptd/
You can use it in prerouting, but because you are doing NAT you will 
need to select for after NAT in the new IMQ from www.linuximq.net or 
patch for NAT if you want to use an older IMQ. You can't mark on de 
natted IPs in prerouting so you need to use u32.

Shaping from the narrow end of the bottleneck is a bit of a kludge, you 
have to set your rates/ceils lower than link speed or you won't have a 
queue to shape with.

If you don't want to have a more complicated script to mark interactive 
packets/use prio etc. I would add 30K bfifos to each class - or if you 
don't mind patching/tweaking use esfq/sfq with a queue length of about 
20, not that these figures are set in stone - but the defaults for htb 
with no queue added or untweaked sfq are alot longer.

Andy.

# delegate all incoming on ppp+ to imq0
iptables -t mangle -A FORWARD -i ppp+ -j IMQ --todev 0
After all this I create the actual tc setup:
# --- snip ---
# clear root qdisc
tc qdisc del dev imq0 root
# add root qdisc (htb)
tc qdisc add dev imq0 root handle 1: htb default 40
# add root class (needed for bandwidth borrowing)
tc class add dev imq0 parent 1: classid 1:1 htb rate 1mbit ceil 1mbit
# set classes for users
tc class add dev imq0 parent 1:1 classid 1:10 htb rate 333kbit ceil 1mbit \
   burst 15k
tc class add dev imq0 parent 1:1 classid 1:20 htb rate 333kbit ceil 1mbit \
   burst 15k
tc class add dev imq0 parent 1:1 classid 1:30 htb rate 333kbit ceil 1mbit \
   burst 15k
tc class add dev imq0 parent 1:1 classid 1:40 htb rate 5kbps
# set filters to direct ips to their classes
tc filter add dev imq0 protocol ip parent 1: prio 1 handle 1 fw flowid 1:10
tc filter add dev imq0 protocol ip parent 1: prio 1 handle 2 fw flowid 1:20
tc filter add dev imq0 protocol ip parent 1: prio 1 handle 3 fw flowid 1:30
# --- snap ---
1:40 is just for testing.
The 'rate'-argument gets applied correctly if I don't use ceil - but I 
do, of
course, want to let the classes borrow free bandwidth, so I use a ceiling
of 1 MBit. And herein lies the problem:

If 1:10 and 1:30 both download a file with full speed, 1:10 gets about
20kb/s (which is under its guaranteed bandwidth!) and 1:30 gets
90 kb/s. What is going wrong here? The shortened output of tc:
class htb 1:1 root rate 1Mbit ceil 1Mbit burst 2909b/8 mpu 0b cburst 
2909b/8 mpu 0b level 7
class htb 1:10 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit 
burst 15Kb/8 mpu 0b cburst
class htb 1:20 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit 
burst 15Kb/8 mpu 0b cburst
class htb 1:30 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit 
burst 15Kb/8 mpu 0b cburst
class htb 1:40 parent 1:1 prio 0 quantum 1000 rate 40Kbit ceil 40Kbit 
burst 1650b/8 mpu 0b cburst

...shows that each class is configured equal.
Any clues? I'd be very, very grateful if anyone could point out errors.
If more output is needed, just tell me.
Kind regards,
Leslie
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-28 Thread Zviad O. Giorgadze
Hello Leslie,
 
I had the same problem for kernel 2.4.27 and it was related to bug in HTB.
Use kernel >=2.6.8.1 or apply patch from Devik's site
http://luxik.cdi.cz/~devik/qos/htb/v3/htbfair.diff.  

Best regards, 

Zviad
 
>Hello,
>
>I have a serious problem with HTB which I wasn't able to solve myself.
>
>I run a masquerading router with ppp0 as interface to the Internet.
>Three clients need to share a downstream of 1 MBit, which I want
>to divide with tc.
>When I see a packet being forwarded to one of these clients, I give
>it the appropriate unique mark:
>
>iptables -t mangle -A FORWARD -d 192.168.34.141 -j MARK --set-mark 1
>iptables -t mangle -A FORWARD -d 192.168.34.140 -j MARK --set-mark 2
>iptables -t mangle -A FORWARD -d 192.168.1.2 -j MARK --set-mark 3
>
>Because it might be of interest: 192.168.34.0/24 is on network A
>with 10 MBit, 192.168.1.0/24 is on network B with 100 MBit.
>
>I then attach an IMQ device imq0 to the FORWARD table:
>
># delegate all incoming on ppp+ to imq0
>iptables -t mangle -A FORWARD -i ppp+ -j IMQ --todev 0
>
>After all this I create the actual tc setup:
>
># --- snip ---
># clear root qdisc
> tc qdisc del dev imq0 root
>
># add root qdisc (htb)
> tc qdisc add dev imq0 root handle 1: htb default 40
>
># add root class (needed for bandwidth borrowing)
> tc class add dev imq0 parent 1: classid 1:1 htb rate 1mbit ceil 1mbit
>
># set classes for users
> tc class add dev imq0 parent 1:1 classid 1:10 htb rate 333kbit ceil 1mbit \
>burst 15k
> tc class add dev imq0 parent 1:1 classid 1:20 htb rate 333kbit ceil 1mbit \
>burst 15k
> tc class add dev imq0 parent 1:1 classid 1:30 htb rate 333kbit ceil 1mbit \
>burst 15k
> tc class add dev imq0 parent 1:1 classid 1:40 htb rate 5kbps
>
># set filters to direct ips to their classes
> tc filter add dev imq0 protocol ip parent 1: prio 1 handle 1 fw flowid 1:10
> tc filter add dev imq0 protocol ip parent 1: prio 1 handle 2 fw flowid 1:20
> tc filter add dev imq0 protocol ip parent 1: prio 1 handle 3 fw flowid 1:30
>
># --- snap ---
>
>1:40 is just for testing.
>
>The 'rate'-argument gets applied correctly if I don't use ceil - but I 
>do, of
>course, want to let the classes borrow free bandwidth, so I use a ceiling
>of 1 MBit. And herein lies the problem:
>
>If 1:10 and 1:30 both download a file with full speed, 1:10 gets about
>20kb/s (which is under its guaranteed bandwidth!) and 1:30 gets
>90 kb/s. What is going wrong here? The shortened output of tc:
>
>class htb 1:1 root rate 1Mbit ceil 1Mbit burst 2909b/8 mpu 0b cburst 
>2909b/8 mpu 0b level 7
>class htb 1:10 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit 
>burst 15Kb/8 mpu 0b cburst
>class htb 1:20 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit 
>burst 15Kb/8 mpu 0b cburst
>class htb 1:30 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit 
>burst 15Kb/8 mpu 0b cburst
>class htb 1:40 parent 1:1 prio 0 quantum 1000 rate 40Kbit ceil 40Kbit 
>burst 1650b/8 mpu 0b cburst
>
>...shows that each class is configured equal.
>
>Any clues? I'd be very, very grateful if anyone could point out errors.
>If more output is needed, just tell me.
>
>
>Kind regards,
>
>Leslie
>
>___
>LARTC mailing list / [EMAIL PROTECTED]
>http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB: Problem with excess bandwidth distribution

2004-10-28 Thread Saad S. B. Faruque
did u try it with sfq ?



On Thu, 28 Oct 2004 18:55:00 +0200, Leslie Patrick Polzer
<[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I have a serious problem with HTB which I wasn't able to solve myself.
> 
> I run a masquerading router with ppp0 as interface to the Internet.
> Three clients need to share a downstream of 1 MBit, which I want
> to divide with tc.
> When I see a packet being forwarded to one of these clients, I give
> it the appropriate unique mark:
> 
> iptables -t mangle -A FORWARD -d 192.168.34.141 -j MARK --set-mark 1
> iptables -t mangle -A FORWARD -d 192.168.34.140 -j MARK --set-mark 2
> iptables -t mangle -A FORWARD -d 192.168.1.2 -j MARK --set-mark 3
> 
> Because it might be of interest: 192.168.34.0/24 is on network A
> with 10 MBit, 192.168.1.0/24 is on network B with 100 MBit.
> 
> I then attach an IMQ device imq0 to the FORWARD table:
> 
> # delegate all incoming on ppp+ to imq0
> iptables -t mangle -A FORWARD -i ppp+ -j IMQ --todev 0
> 
> After all this I create the actual tc setup:
> 
> # --- snip ---
> # clear root qdisc
>  tc qdisc del dev imq0 root
> 
> # add root qdisc (htb)
>  tc qdisc add dev imq0 root handle 1: htb default 40
> 
> # add root class (needed for bandwidth borrowing)
>  tc class add dev imq0 parent 1: classid 1:1 htb rate 1mbit ceil 1mbit
> 
> # set classes for users
>  tc class add dev imq0 parent 1:1 classid 1:10 htb rate 333kbit ceil 1mbit \
> burst 15k
>  tc class add dev imq0 parent 1:1 classid 1:20 htb rate 333kbit ceil 1mbit \
> burst 15k
>  tc class add dev imq0 parent 1:1 classid 1:30 htb rate 333kbit ceil 1mbit \
> burst 15k
>  tc class add dev imq0 parent 1:1 classid 1:40 htb rate 5kbps
> 
> # set filters to direct ips to their classes
>  tc filter add dev imq0 protocol ip parent 1: prio 1 handle 1 fw flowid 1:10
>  tc filter add dev imq0 protocol ip parent 1: prio 1 handle 2 fw flowid 1:20
>  tc filter add dev imq0 protocol ip parent 1: prio 1 handle 3 fw flowid 1:30
> 
> # --- snap ---
> 
> 1:40 is just for testing.
> 
> The 'rate'-argument gets applied correctly if I don't use ceil - but I
> do, of
> course, want to let the classes borrow free bandwidth, so I use a ceiling
> of 1 MBit. And herein lies the problem:
> 
> If 1:10 and 1:30 both download a file with full speed, 1:10 gets about
> 20kb/s (which is under its guaranteed bandwidth!) and 1:30 gets
> 90 kb/s. What is going wrong here? The shortened output of tc:
> 
> class htb 1:1 root rate 1Mbit ceil 1Mbit burst 2909b/8 mpu 0b cburst
> 2909b/8 mpu 0b level 7
> class htb 1:10 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit
> burst 15Kb/8 mpu 0b cburst
> class htb 1:20 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit
> burst 15Kb/8 mpu 0b cburst
> class htb 1:30 parent 1:1 prio 0 quantum 4262 rate 333Kbit ceil 1Mbit
> burst 15Kb/8 mpu 0b cburst
> class htb 1:40 parent 1:1 prio 0 quantum 1000 rate 40Kbit ceil 40Kbit
> burst 1650b/8 mpu 0b cburst
> 
> ...shows that each class is configured equal.
> 
> Any clues? I'd be very, very grateful if anyone could point out errors.
> If more output is needed, just tell me.
> 
> Kind regards,
> 
> Leslie
> 
> ___
> LARTC mailing list / [EMAIL PROTECTED]
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 


-- 
Saad S. B. Faruque
MCSE, RHCT, CCNA
Head of NOC
MTL BD Ltd.
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB problem...

2004-09-07 Thread Andreas Klauer
Am Tuesday 07 September 2004 23:18 schrieb Cow:
> zytec: (?)
> > I assume that you want somethink like:
> > data from server to LAN (PC1,PC2) unshaped (full 100mbit)
> > data from Internet to LAN shaped
>
> Correct.

Not really an example, but you may have a look at my script [1].

It solves the 100Mbit LAN vs internet traffic by using a class setup which 
looks like [2], which reminds me that I did a modification to wondershaper 
once [3] that does the same. I think this modification was reported to 
work, however I haven't tested it nor do I support it. Maybe it serves as 
an example...

I'm using a fat HTB class which knows the true interface bandwidth (100MBit 
isn't actually right, you should measure what rates you really get). Then 
there's a child class for the internet traffic and one for the actual LAN 
traffic. If HTB works correctly, this way you get full speed for LAN-only 
transfers, without letting them interfere with the internet traffic.

The script [1] is the one I'm (more or less) actively working on; it 
doesn't support custom rates per user yet, but that's something that'll be 
added for sure in one of the next releases.

HTH
Andreas

[1] http://www.metamorpher.de/fairnat/
[2] http://www.metamorpher.de/files/wshaper-over-lan.png
[3] http://www.metamorpher.de/files/wshaper-over-lan.htb
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB problem...

2004-09-07 Thread zytek
Dnia poniedziałek 06 wrzesień 2004 23:56, Cow napisał:
> Hi folks.
>
> Let's say I would like to make some bandwidth control on my network
> using HTB. I have 2 clients:
[...]
> I think a script as i described, could be very complex to write,
> therefore i ask, whoever is here, for help.
> Thank you all in advance.


Hello all, my first post here, maybe even I will help someone;)

I assume that you want somethink like:
data from server to LAN (PC1,PC2) unshaped (full 100mbit)
data from Internet to LAN shaped

Then all you need to do is make classes with source 192.168.0.1 and 
destination 192.168.0.2(3) and 100mbit rate and then make classes with 
destination 192.168.0.2(3) with download rate. I believe that you understand 
what I am thinkig of.

Or you can use iptables and mark traffic going from server to LAN, and other 
mark for traffic in FORWARD chain. (iptables -t mangle -A FORWARD -j MARK 
--set-mark SOME_MARK)
When using iptables you will be able to shape upload speed, just mark traffic 
in forward going from PC1/2 with output interface eth2 (-o eth2) - it will be 
hosts upload.

I won't write you full script, make it yourself, visit LARTC and firstly try 
"htb.init" for simple class creation. Good fun!


-- 
.: Jakub Głazik (zytek)
.: email:[EMAIL PROTECTED]
.: JID:[EMAIL PROTECTED]
.: http://www.misiaj.sie.pl [obsolete]
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB problem

2003-12-04 Thread Catalin BOIE
> > Hello,
> >
> > I'm having some problems using HTB to prioritize traffic on my linux
> > router.
> > The main problem is as follows:
> > I have a 6Mbits channel on the metropolitan network and a 64kbps link
> > for the sites outside my country.
> >
> > These 64kbps are dynamically allocated by my ISP so I usually get
> > something like 128kbps , sometimes 512kbps and even 1 Mbit; it varies
> > all the time.
> >
> > Because of this I don't know how to automatically adjust my HTB script
> > depending on the total bandwidth available on the external link
> > (without specifying the maximum to 64kbps thus limitting every
> > connection even if my ISP grants me more than this bandwidth).
> >
> > Anyone got any ideas ?

You cannot have a variable bandwidth with htb.
Count on the minimum bandwidth.

> >
> >
> >
> > ___
> > LARTC mailing list / [EMAIL PROTECTED]
> > http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>
>
> ___
> LARTC mailing list / [EMAIL PROTECTED]
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>

---
Catalin(ux) BOIE
[EMAIL PROTECTED]
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB problem

2003-12-03 Thread Mihai Tanasescu
Doesn't anyone have any ideas regarding  my problem ?

Mihai Tanasescu wrote:

Hello,

I'm having some problems using HTB to prioritize traffic on my linux 
router.
The main problem is as follows:
I have a 6Mbits channel on the metropolitan network and a 64kbps link 
for the sites outside my country.

These 64kbps are dynamically allocated by my ISP so I usually get 
something like 128kbps , sometimes 512kbps and even 1 Mbit; it varies 
all the time.

Because of this I don't know how to automatically adjust my HTB script 
depending on the total bandwidth available on the external link 
(without specifying the maximum to 64kbps thus limitting every 
connection even if my ISP grants me more than this bandwidth).

Anyone got any ideas ?



___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB Problem

2003-09-30 Thread Stef Coene
On Tuesday 30 September 2003 15:44, Guilherme Benkenstein wrote:
> Hi all!!
>
> I'm new in the list.
>
> I'm using Slackware 9.0 with 2.4.21
>
> HTB 0.8.3
>
> eth0
>
> DEFAULT=30
>
> eth0-2:30.dfl
>
> RATE=256Kbit
> BURST=32Kb
> LEAF=sfq
>
> This is my configuration, but, the shaper dosen't works in 32Kbps...
>
> Anybody can help me?
Yes and no.
I think you are using htb.init and this is not the htb.init mailing list.

Stef

-- 
[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.openprojects.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-07-28 Thread Stef Coene
On Thursday 24 July 2003 16:26, Delcho wrote:
> Hello,
> I have a problem with my htb in linux gateway machine.
> Wana make this borrow to and from internet:
> every user must be shaped to 32Kbit,max number of users are 6 in one
> subnet /29
> and all subnet must be shaped to 92Kbit,e.i every user  will download
> with 32Kbit,but when
> all 6 user download do not over 92Kbit! I make some classes /attache
> them/ but every user download with 32Kbit and over many up 92Kbit.
> The script:
>
> tc qdisc add dev eth1 root handle 1: htb default 2
>  tc class add dev eth1 parent 1: classid 1:2 htb rate 100Mbit
> ceil 100Mbit burst 1k
>  tc class add dev eth1 parent 1:2 classid 1:11 htb rate
> 92Kbit ceil 92Kbit burst 1k
> tc qdisc add dev eth1 parent 1:11 handle 11 sfq perturb 10
>  tc class add dev eth1 parent 1:11 classid 1:30 htb rate
> 32Kbit ceil 32Kbit burst 1k
> tc qdisc add dev eth1 parent 1:30 handle 30 sfq perturb 10
>  tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
> match ip dst 192.168.1.17 classid 1:30
>  tc class add dev eth1 parent 1:11 classid 1:40 htb rate
> 32Kbit ceil 32Kbit burst 1k
> tc qdisc add dev eth1 parent 1:40 handle 40 sfq perturb 10
>  tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
> match ip dst 192.168.1.18 classid 1:40
> 
>  tc class add dev eth1 parent 1:11 classid 1:80 htb rate
> 32Kbit ceil 32Kbit burst 1k
> tc qdisc add dev eth1 parent 1:80 handle 80 sfq perturb 10
>  tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
> match ip dst 192.168.1.22 classid 1:80
>
> May be there is mistake but where.?
Take a look at the faq pages on docum.org.  There is a section with htb rules.  
The problem is that the rate is a minium and the parent ceil is not respected 
if the child classes are asking more then the ceil.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-06-25 Thread Ratel
Thx a lot for help , I finally managed to rebuild my firewall script,

for people who have same problem as I had, I can say that
the problem lies in propper packet marking (iptables) , sample lines from my
firewall script :

iptables -t mangle -I PREROUTING -i eth0 -p tcp --dport 21 -j
MARK --set-mark 2
iptables -t mangle -I PREROUTING -i eth0 -p tcp --dport 443 -j
MARK --set-mark 3

it's ofcourse not the only way to mark them,
http://www.docum.org/stef.coene/qos/kptd/ is very useful with that.

regards, Ratel <[EMAIL PROTECTED]>


- Original Message -
From: "Stef Coene" <[EMAIL PROTECTED]>
To: "Ratel" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, June 12, 2003 9:35 PM
Subject: Re: [LARTC] htb problem


> On Thursday 12 June 2003 21:21, Ratel wrote:
> > Hi,
> >
> > I have some interesting problem with htb , I set up root class and
> > sub-classess:
> >
> > $TC qdisc add dev eth0 root handle 1: htb
> > $TC class add dev eth0 parent 1: classid 1:1 htb rate 1990kbit ceil
> > 2000kbit $TC class add dev eth0 parent 1:1 classid 1:10 htb rate 190kbit
> > ceil 200kbit $TC class add dev eth0 parent 1:1 classid 1:11 htb rate
> > 1400kbit ceil 1600kbit
> > $TC class add dev eth0 parent 1:1 classid 1:12 htb rate 1000kbit ceil
> > 1500kbit
> > $TC class add dev eth0 parent 1:1 classid 1:13 htb rate 1000kbit ceil
> > 1500kbit
> > $TC class add dev eth0 parent 1:1 classid 1:14 htb rate 1000kbit ceil
> > 1200kbit
> The sum of the rates of the childs should be <= rate of parent.  In your
case
> 1400 + 1000 + 1000 + 1000 = 4400 and your parent rate is 1990.  It's not
> needed, but I recommend it.
>
> > , filters and queuing disciplines :
> > #filter
> > $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 2 fw flowid
> > 1:10 classid 1:10
> > $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 3 fw flowid
> > 1:11 classid 1:11
> > $TC filter add dev eth0 protocol ip parent 1:0 prio 2 handle 4 fw flowid
> > 1:12 classid 1:12
> > $TC filter add dev eth0 protocol ip parent 1:0 prio 3 handle 5 fw flowid
> > 1:13 classid 1:13
> > $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 6 fw flowid
> > 1:14 classid 1:14
> > (note the packet marking classifier)
> And I also note the different prios.  That's not needed.  Prio determines
the
> order the filters are checked.  In your case it doesn't matter.
>
> > adequate lines from firewall script :
> > [...]
> > # ftp
> > $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
> > NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
> > # ssh
> > $$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
> > NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
> > # smtp
> > $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
> > NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
> > [...]
> Mhh.  Can you check with iptables -L -v -n that your packets are marked?
And
> can you tell us what's your setup ?  I mean wich nic is connected to the
> internet, what do you want to shape, is this also a firewall?  And try
> marking in the PREROUTING tables.
>
>
> Stef
>
> --
>
> [EMAIL PROTECTED]
>  "Using Linux as bandwidth manager"
>  http://www.docum.org/
>  #lartc @ irc.oftc.net
>
> ___
> LARTC mailing list / [EMAIL PROTECTED]
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-06-15 Thread Stef Coene
On Saturday 14 June 2003 23:46, [EMAIL PROTECTED] wrote:
> Hey I hve the same problem. My packets are marked, my classes are OK
> my filters are set OK
> and all packets are passing through the root class!!
> I think that this is a big problem. A know 1 more person that has the same
> problem!
Ok.  I don't understand.  I do all my test using iptables and fw filter.  This 
works for me :
tc filter add dev eth0 parent 1: protocol ip handle 1 fw classid 1:100
iptables -A OUTPUT -t mangle -p tcp --dport 2000 -j MARK --set-mark 1

This is on a simple pc.  No router, no bridge, no firewall.  It's only used to 
shape outgoing locally bandwidth.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-06-14 Thread terahz

Hey I hve the same problem. My packets are marked, my classes are OK
my filters are set OK
and all packets are passing through the root class!!
I think that this is a big problem. A know 1 more person that has the same
problem!
--- изпратено от  mail.bG
Силна Анти-спам защита
12MB Място за поща
SMS за нов емeйл и към двата оператора!
POP3/WAP Достъп
_
HOB
 БEЗПЛATEH AДPEC

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-06-12 Thread Stef Coene
On Thursday 12 June 2003 23:08, Esteban wrote:
> my set up is like this:
>
> #!/bin/bash
> DEV=eth1
>
> tc qdisc del dev $DEV root2> /dev/null > /dev/null
> tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
>
> tc qdisc add dev $DEV root handle 1: htb
>
> tc class add dev $DEV parent 1: classid 1:1 htb rate 512kbit burst 6k
> tc class add dev $DEV parent 1:1 classid 1:10 htb rate 512kbit burst 6k
> prio 1 tc class add dev $DEV parent 1:1 classid 1:20 htb rate 50kbit burst
> 6k prio 3
>
> 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 protocol ip parent 1:0 prio 1 handle 0x1 fw flowid
> 1:20
>
>
> iptables -t mangle -A FORWARD -i eth1 -j MARK --set-mark 1
>
> os?? any idea?
Remove burst and prio parameter from your commands.  And make sure the sum of 
child rates <= parent rate.  In your case 512 + 50 >> 512.
And all non-classified packets have to go somewhere.  This can be done with 
the default parameter if you add the htb root disc or a catch all filter 
rule.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-06-12 Thread Stef Coene
On Thursday 12 June 2003 21:46, Esteban wrote:
> Stef! please explain me this:
> When i use traffic shaper, i apply the root to the innterface i want to
> controll the packets that are leaving right? 
Yes.

> The sum of classes "should"
> not be greater than the root one.
> Supossing i have 2 nics. One for internal (eth1) and other for internet
> (eth0). i can mangle packets:
> -t mangle -I PREROUTING -i eth1 -j MARK --set-mark 1
>
> and then filter them all on the eth0 device with:
> tc filter add dev $DEV protocol ip parent 1:0 prio 1 handle 0x1 fw flowid
> 1:20 is this okay?
Yes.

> Cause for me, is not working.
> jeje..i see packets accounting on the right class, but they dont go to the
> speed i want (i see that in that class are much packets "lended")..that
> might be that that class is asking for BW to greater classes? if you can
> would be a great help to clear out this doubts!
So your filters are working.  The lended packets are not important.
For your htb setup, have you read the docs I collected on www.docum.org ?

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-06-12 Thread Stef Coene
On Thursday 12 June 2003 22:04, Morten Isaksen wrote:
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> > Behalf Of Stef Coene
> > Sent: 12. juni 2003 21:35
> > To: Ratel; [EMAIL PROTECTED]
> > Subject: Re: [LARTC] htb problem
> >
> > > adequate lines from firewall script :
> > > [...]
> > > # ftp
> > > $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
> > > NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
> > > # ssh
> > > $$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
> > > NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
> > > # smtp
> > > $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
> > > NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
> > > [...]
> >
> > Mhh.  Can you check with iptables -L -v -n that your packets are marked?
> > And
> > can you tell us what's your setup ?  I mean wich nic is connected to the
> > internet, what do you want to shape, is this also a firewall?  And try
> > marking in the PREROUTING tables.
>
> I have the same problem. According to iptables the packets are marked but
> all the traffic goes to the root htb class.
Mhh.  Some commands that works for me :

tc filter add dev eth0 parent 1: protocol ip handle 1 fw classid 1:100
iptables -A OUTPUT -t mangle -p tcp --dport 2000 -j MARK --set-mark 1


Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


RE: [LARTC] htb problem

2003-06-12 Thread Morten Isaksen

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Stef Coene
> Sent: 12. juni 2003 21:35
> To: Ratel; [EMAIL PROTECTED]
> Subject: Re: [LARTC] htb problem
> 
> > adequate lines from firewall script :
> > [...]
> > # ftp
> > $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
> > NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
> > # ssh
> > $$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
> > NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
> > # smtp
> > $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
> > NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
> > [...]
> Mhh.  Can you check with iptables -L -v -n that your packets are marked?
> And
> can you tell us what's your setup ?  I mean wich nic is connected to the
> internet, what do you want to shape, is this also a firewall?  And try
> marking in the PREROUTING tables.

I have the same problem. According to iptables the packets are marked but
all the traffic goes to the root htb class.

--
Morten Isaksen
[EMAIL PROTECTED] - http://www.aub.dk/~misak


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-06-12 Thread Stef Coene
On Thursday 12 June 2003 21:21, Ratel wrote:
> Hi,
>
> I have some interesting problem with htb , I set up root class and
> sub-classess:
>
> $TC qdisc add dev eth0 root handle 1: htb
> $TC class add dev eth0 parent 1: classid 1:1 htb rate 1990kbit ceil
> 2000kbit $TC class add dev eth0 parent 1:1 classid 1:10 htb rate 190kbit
> ceil 200kbit $TC class add dev eth0 parent 1:1 classid 1:11 htb rate
> 1400kbit ceil 1600kbit
> $TC class add dev eth0 parent 1:1 classid 1:12 htb rate 1000kbit ceil
> 1500kbit
> $TC class add dev eth0 parent 1:1 classid 1:13 htb rate 1000kbit ceil
> 1500kbit
> $TC class add dev eth0 parent 1:1 classid 1:14 htb rate 1000kbit ceil
> 1200kbit
The sum of the rates of the childs should be <= rate of parent.  In your case 
1400 + 1000 + 1000 + 1000 = 4400 and your parent rate is 1990.  It's not 
needed, but I recommend it.

> , filters and queuing disciplines :
> #filter
> $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 2 fw flowid
> 1:10 classid 1:10
> $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 3 fw flowid
> 1:11 classid 1:11
> $TC filter add dev eth0 protocol ip parent 1:0 prio 2 handle 4 fw flowid
> 1:12 classid 1:12
> $TC filter add dev eth0 protocol ip parent 1:0 prio 3 handle 5 fw flowid
> 1:13 classid 1:13
> $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 6 fw flowid
> 1:14 classid 1:14
> (note the packet marking classifier)
And I also note the different prios.  That's not needed.  Prio determines the 
order the filters are checked.  In your case it doesn't matter.

> adequate lines from firewall script :
> [...]
> # ftp
> $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
> NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
> # ssh
> $$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
> NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
> # smtp
> $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
> NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
> [...]
Mhh.  Can you check with iptables -L -v -n that your packets are marked?  And 
can you tell us what's your setup ?  I mean wich nic is connected to the 
internet, what do you want to shape, is this also a firewall?  And try 
marking in the PREROUTING tables.


Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] htb problem

2003-06-12 Thread Esteban
do you have two nics? the 2megas internet is eth0 right? so you are tc'ing packets 
going out of interface eth0.

paquets are comming from eth1 for example? 
in such case you coutlf -t mangle -I PREROUTING -i eth1 -j MARK --set-mark {1|2|4|}
??

so packets going from internal (eth1) going out (eth0) are previusly marked.
im pretty sure about this.
hope it helps, good luck.


Quoting Ratel <[EMAIL PROTECTED]>:

> Hi,
> 
> I have some interesting problem with htb , I set up root class and
> sub-classess:
> 
> $TC qdisc add dev eth0 root handle 1: htb
> $TC class add dev eth0 parent 1: classid 1:1 htb rate 1990kbit ceil 2000kbit
> $TC class add dev eth0 parent 1:1 classid 1:10 htb rate 190kbit ceil 200kbit
> $TC class add dev eth0 parent 1:1 classid 1:11 htb rate 1400kbit ceil
> 1600kbit
> $TC class add dev eth0 parent 1:1 classid 1:12 htb rate 1000kbit ceil
> 1500kbit
> $TC class add dev eth0 parent 1:1 classid 1:13 htb rate 1000kbit ceil
> 1500kbit
> $TC class add dev eth0 parent 1:1 classid 1:14 htb rate 1000kbit ceil
> 1200kbit
> 
> , filters and queuing disciplines :
> #filter
> $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 2 fw flowid
> 1:10 classid 1:10
> $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 3 fw flowid
> 1:11 classid 1:11
> $TC filter add dev eth0 protocol ip parent 1:0 prio 2 handle 4 fw flowid
> 1:12 classid 1:12
> $TC filter add dev eth0 protocol ip parent 1:0 prio 3 handle 5 fw flowid
> 1:13 classid 1:13
> $TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 6 fw flowid
> 1:14 classid 1:14
> (note the packet marking classifier)
> 
> adequate lines from firewall script :
> [...]
> # ftp
> $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
> NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
> # ssh
> $$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
> NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
> # smtp
> $IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
> NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
> [...]
> 
> #qdisc
> $TC qdisc add dev eth0 parent 1:10 handle 20: sfq perturb 10
> $TC qdisc add dev eth0 parent 1:11 handle 30: sfq perturb 10
> $TC qdisc add dev eth0 parent 1:12 handle 40: sfq perturb 10
> $TC qdisc add dev eth0 parent 1:13 handle 50: sfq perturb 10
> $TC qdisc add dev eth0 parent 1:14 handle 60: sfq perturb 10
> 
> the problem is - all the traffic goes only through root class '1:'
> 
> #tc -s qdisc ls dev eth0
> qdisc sfq 60: quantum 1514b perturb 10sec
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
> 
>  qdisc pfifo 50: limit 5p
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
> 
>  qdisc pfifo 40: limit 5p
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
> 
>  qdisc pfifo 30: limit 5p
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
> 
>  qdisc pfifo 20: limit 5p
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
> 
>  qdisc htb 1: r2q 10 default 0 direct_packets_stat 671
>  Sent 392890 bytes 671 pkts (dropped 0, overlimits 0)
> 
> 
> I'd be very grateful , if you could help me with this.
> 
> thanks in advance.
> 
> Ratel .at. aonet.pl
> 
> 
> ___
> LARTC mailing list / [EMAIL PROTECTED]
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB problem

2003-01-23 Thread Jay Wineinger
grr, I thought i had checked everything close.  Thanks =)

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



Re: [LARTC] HTB problem

2003-01-23 Thread mingching.tiew
You have a typo :-  kpbs

Also, it seems that the parent 1:1 is not created yet.

- Original Message -
From: "Jay Wineinger" <[EMAIL PROTECTED]>
>
> However, I get an error about illegal rate when I try to create a class
> with:
> $TC class add dev eth0 parent 1:1 classid 1:10 htb rate 30kpbs burst
2k
> prio 1 ceil 100kbps
>



___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



Re: [LARTC] HTB Problem

2002-12-09 Thread Stef Coene
On Monday 09 December 2002 19:19, [EMAIL PROTECTED] wrote:
> Hello,
>
>  I am shaping traffic for ~250 users and i have noticed something is wrong:
>  Each user is being shaped from 32kbit/s to 2mbit/s.
>
>  When i run the script which creates the classes the following error is
> printed to syslog: Dec  9 19:53:34 p1 kernel: HTB: quantum of class 10009
> is small. Consider r2q change.<4>HTB: quantum of class 10055 is small.
> Consider r2q change.<4>HTB: quantum of class 10082 is small. Consider r2q
> change.<4>HTB: quantum of class 10103 is small. Consider r2q change.<4>HTB:
> quantum of class 10106 is small. Consider r2q change.<4>HTB: quantum of
> class 10109 is small. Consider r2q change.
> ... etc etc.
>
> I searched google and found some posts on this error, they said to change
> the r1q quantum value, tho it wasnt clearly said how big the value should
> be.
>
> Could anyone tell me what r2q value to set if thaffic is shaped to 32kbit,
> 64 kbit and 128kbit/s?
Quantum = rate / r2q.  Quantum should be > 1500 and smaller then 60.000.
I have some more info on www.docum.org on the faq page.

> I read the manual of HTB and it says:
> 'Normaly you don't need to specify quantums manualy as HTB chooses
> precomputed values. It computes classe's quantum (when you add or change
> it) as its rate divided by r2q global parameter. Its default value is 10
> and because typical MTU is 1500 the default is good for rates from 15 kBps
> (120 kbit). For smaller minimal rates specify r2q 1 when creating qdisc -
> it is good from 12 kbit which should be enough'
>
> So, is
> 'r2q 3' enough for 32kbit/s
> 'r2q 6' enough for 64kbit/s
> and
> 'r2q 10' (default) enough for 128kbit/s+?
>
>
> Soon after the 'HTB: quantum of class  is small' messages in syslog
> i get the following errors from HTB:
> (around 10 minutes after the warnings of 'quantum of class  is
> small':
>
> Dec  9 20:04:43 p1 kernel: HTB: bad diff in events, cl=10345 diff=46CE
> now=1187872768 then=4294934528 j=10106476
> Dec  9 20:04:48 p1 kernel: NET: 189 messages suppressed.
> Dec  9 20:04:48 p1 kernel: HTB: bad diff in events, cl=10054 diff=470D
> now=1191976960 then=4294909952 j=10106977
> Dec  9 20:04:53 p1 kernel: NET: 190 messages suppressed.
> Dec  9 20:04:53 p1 kernel: HTB: bad diff in events, cl=10054 diff=474C
> now=1196105728 then=4294909952 j=10107481
>
> And it seems the classes start dying one after other, cause the clients
> start calling me and screaming 'internet doesnt work'.
> as soon as i flush qdisc, everything works perfect again.
> So for now i have put the traffic script in crontab flushing and adding
> classes every 15 minutes.
>
> Any suggestions?
>
> I am using HTB 3.6 and Linux 2.4.19
>
> I tried Linux 2.4.20 with HTB included, tho the results were much more poor
> - if i shaped traffic to 256kbit/s on 2.4.19 the ping was around 200ms
> (constant), tho on 2.4.20 it was increasing and decreasing dramatically -
> from 6000ms to 80ms.
2.4.20 has htb 3.6.  So it's the same version.  It's strange that you have 
different results.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



Re: [LARTC] HTB - problem with one thread

2002-08-29 Thread Ciprian Nica


On Wednesday 28 August 2002 20:45, Stef Coene wrote:

> > The problem is that clients can have their bandwidths at maximum only if
> > they use a download accelerating software like DAP with multiple
> > symultanous threads. Using only one thread, a single download can reach
> > about 60% of the allocated bandwidth.
>
> Quantum is used if 2 or more classes with the same parent are fighting for
> bandwidth.  First, they are allowed to get the rate you gave them.  For the
> remaining bandwidth, quantum is used.  Each class may send quantum bytes.
> You have to make sure quantum > MTU (typical 1500 bytes for ethernet).
>
> What if you use no sfq qdiscs?
>
> Stef

I have tried with pfifo queues and it's the same. I made many tests changing 
quantum, queueing for leaf but in no case I could reach the allocated 
bandwidth with a single download thread. The same limit set on cisco router 
with traffic-shape, worked fine. 

Could there be a problem when there are many qdiscs ? Are there many 
calculations to be done, so the packets get delayed and the TCP transfer rate 
is lowered. 

Ciprian

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



Re: [LARTC] HTB - problem with one thread

2002-08-28 Thread Stef Coene

On Wednesday 28 August 2002 15:15, Ciprian Nica wrote:
> Hello,
>
> Besides a very good functionality, I have a small, yet stressing, problem.
>
> Let's say I have a bandwidth of N bits.
>
> I have X clients, everyone with his fixed bandwidth.
>
> I create htb qdsics for each client. Each leaf has sfq queueing
> discipline.
>
> A sample config would be like this :
>
> tc class add dev eth0 parent 1:2 classid 1:346 htb rate 32Kbit ceil 32Kbit
>burst 4k cburst 2k prio 4
> tc qdisc add dev eth0 parent 1:346 handle 346 sfq perturb 10
>
> AND
>
> tc class add dev eth0 parent 1:2 classid 1:161 htb rate 256Kbit ceil
>256Kbit burst 32k cburst 2k prio 4
> tc qdisc add dev eth0 parent 1:161 handle 161 sfq perturb 10
>
>
> The filters are like :
> tc filter add dev eth0 parent 1:0 protocol ip prio 100 u32 match ip dst
> 1.2.3.128/25 classid 1:346 tc filter add dev eth0 parent 1:0 protocol ip
> prio 100 u32 match ip dst 1.2.3.4/30 classid 1:161
>
> The problem is that clients can have their bandwidths at maximum only if
> they use a download accelerating software like DAP with multiple
> symultanous threads. Using only one thread, a single download can reach
> about 60% of the allocated bandwidth.
>
> I have tested a download without any limits and it was working well, so
> there's no problem with the remote site.
>
> I have searched thorugh messages posted on this mailing list but I didn't
> find a similar problem.
>
>
> Maybe I need to set quantum manually. I have tested with r2q default value
> (10) and also with 2 (raising quantum).
>
> Another question would be: if quantum is bigger, the client can exceed his
> limit by that value ? Is that possible all the time or at bursty intervals
> ?
Quantum is used if 2 or more classes with the same parent are fighting for 
bandwidth.  First, they are allowed to get the rate you gave them.  For the 
remaining bandwidth, quantum is used.  Each class may send quantum bytes.  
You have to make sure quantum > MTU (typical 1500 bytes for ethernet).

What if you use no sfq qdiscs?

Stef


-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



Re: [LARTC] HTB problem (yet another one?)

2002-08-21 Thread Stef Coene

> endeavour:~# tc qdisc add dev imq0 root handle 1 htb ttt
> What is "ttt"?
> Usage: ... qdisc add ... htb [default N] [r2q N]
>  default  number of class to which unclassified packets are sent {1}
> 
Why do you have that "ttt" option?  If you remove ttt from the command, does 
it work?

> -
> And the PROBLEM:
>
> When i try to add qdisc to the imq device.. a get:
>
> endeavour:~# tc qdisc add dev imq0 root handle 1 htb default 20 r2q 10
> RTNETLINK answers: Invalid argument
> -
>
> BTW: Adding CBQ qdisc to imq0 works fine... Any suggestions ?
What if you add a htb qdisc with no options ?
tc qdisc add dev imq0 root handle 1 htb

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



Re: [LARTC] HTB problem !

2002-05-14 Thread Arindam Haldar

Stef Coene wrote:

> On Tuesday 14 May 2002 08:22, Arindam Haldar wrote:
> 
>>hi all
>>
>>After patching & compiling htb3_2.4.17; imq-2.4.18; sch_geberic with
>>kernal 2.4.18 and  iptables-1.2.6a-imq with iptables-1.2.7-20020423 i
>>faced the folowing problem patching htb3_tc with
>>iproute2-2.4.7-now-ss010824--->
>>
>>[root@test iproute2]# patch -p1 < ../htb3_tc.diff
>>patching file tc/q_htb.c
>>patching file tc/Makefile
>>Hunk #1 FAILED at 13.
>>1 out of 1 hunk FAILED -- saving rejects to file tc/Makefile.rej
>>[root@test iproute2]#
>>
>>
>>pls i need help for u gurus is solving it.
>>
> The latest release of htb3 fixes this.
> 
> Stef
> 
> 

thanx stef ... solved !! :)

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



Re: [LARTC] HTB problem !

2002-05-14 Thread Stef Coene

On Tuesday 14 May 2002 08:22, Arindam Haldar wrote:
> hi all
>
> After patching & compiling htb3_2.4.17; imq-2.4.18; sch_geberic with
> kernal 2.4.18 and  iptables-1.2.6a-imq with iptables-1.2.7-20020423 i
> faced the folowing problem patching htb3_tc with
> iproute2-2.4.7-now-ss010824--->
>
> [root@test iproute2]# patch -p1 < ../htb3_tc.diff
> patching file tc/q_htb.c
> patching file tc/Makefile
> Hunk #1 FAILED at 13.
> 1 out of 1 hunk FAILED -- saving rejects to file tc/Makefile.rej
> [root@test iproute2]#
>
>
> pls i need help for u gurus is solving it.
The latest release of htb3 fixes this.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.openprojects.net
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/