Re: ALTQ

2009-04-14 Thread Robert
On Tue, 14 Apr 2009 14:23:48 +0200
"Helmut Schneider"  wrote:

> Hi,
> 
> My proxy has one single GB interface and is connected to the internet
> using a E3-line (34Mb). I want to shape http traffic to 5Mb/s. How?
> 
> Something like:
> 
> altq on $extIF cbq bandwidth 100% queue { default, http_traf }
> queue default bandwidth 100% cbq(default borrow)
> queue http_traf bandwidth 5Mb cbq(borrow)
> 
> What is the correct syntax?
> 
> Thanks, Helmut
> 

This is explained (with an example you can adapt) in the PF FAQ.
http://www.openbsd.org/faq/pf/queueing.html

- Robert


Re: ALTQ

2009-04-14 Thread Helmut Schneider

From: "Robert" 

"Helmut Schneider"  wrote:

My proxy has one single GB interface and is connected to the internet
using a E3-line (34Mb). I want to shape http traffic to 5Mb/s. How?

Something like:

altq on $extIF cbq bandwidth 100% queue { default, http_traf }
queue default bandwidth 100% cbq(default borrow)
queue http_traf bandwidth 5Mb cbq(borrow)

What is the correct syntax?

Thanks, Helmut


This is explained (with an example you can adapt) in the PF FAQ.
http://www.openbsd.org/faq/pf/queueing.html


No, it's not. The FAQ talks about two interfaces, I only do have one single 
interface. I also did not find an example where the default queue may use 
100% percent and HTTP may use lets say 5Mb from that amount.


If I'm wrong please point me to the specific location.

Thanks, Helmut 


Re: ALTQ

2009-04-14 Thread Robert
On Tue, 14 Apr 2009 15:39:48 +0200
"Helmut Schneider"  wrote:

> From: "Robert" 
> > "Helmut Schneider"  wrote:
> >> My proxy has one single GB interface and is connected to the
> >> internet using a E3-line (34Mb). I want to shape http traffic to
> >> 5Mb/s. How?
> >>
> >> Something like:
> >>
> >> altq on $extIF cbq bandwidth 100% queue { default, http_traf }
> >> queue default bandwidth 100% cbq(default borrow)
> >> queue http_traf bandwidth 5Mb cbq(borrow)
> >>
> >> What is the correct syntax?
> >>
> >> Thanks, Helmut
> >
> > This is explained (with an example you can adapt) in the PF FAQ.
> > http://www.openbsd.org/faq/pf/queueing.html
> 
> No, it's not. The FAQ talks about two interfaces, I only do have one
> single interface. I also did not find an example where the default
> queue may use 100% percent and HTTP may use lets say 5Mb from that
> amount.
> 
> If I'm wrong please point me to the specific location.
> 
> Thanks, Helmut 

Doesn't this section explain how to do it?
http://www.openbsd.org/faq/pf/queueing.html#assign

- Robert


Re: ALTQ

2009-04-14 Thread Helmut Schneider

From: "Robert" 

On Tue, 14 Apr 2009 15:39:48 +0200
"Helmut Schneider"  wrote:


From: "Robert" 

"Helmut Schneider"  wrote:

My proxy has one single GB interface and is connected to the
internet using a E3-line (34Mb). I want to shape http traffic to
5Mb/s. How?

Something like:

altq on $extIF cbq bandwidth 100% queue { default, http_traf }
queue default bandwidth 100% cbq(default borrow)
queue http_traf bandwidth 5Mb cbq(borrow)

What is the correct syntax?

Thanks, Helmut


This is explained (with an example you can adapt) in the PF FAQ.
http://www.openbsd.org/faq/pf/queueing.html


No, it's not. The FAQ talks about two interfaces, I only do have one
single interface. I also did not find an example where the default
queue may use 100% percent and HTTP may use lets say 5Mb from that
amount.

If I'm wrong please point me to the specific location.


Doesn't this section explain how to do it?
http://www.openbsd.org/faq/pf/queueing.html#assign


Well, if then I do not understand it. The section states:

altq on fxp0 cbq bandwidth 2Mb queue { std, ftp }
queue std bandwidth 500Kb cbq(default)
queue ftp bandwidth 1.5Mb

What I want to do is to assign the default queue the whole bandwith (100%) 
and let e.g. http borrow 5Mb. As I do not know the connection speed (might 
be 1GB or 100Mb within the local LAN, but might also be 34Mb for the 
internet) I guess I need to mix absolute values and percentages which I 
currently fail to implement.


What I tried:

altq on $extIF cbq bandwidth 100% queue { default, http_traf }
queue default bandwidth 100% cbq(default borrow)
queue [default_]http_traf bandwidth 5Mb cbq(borrow)

which does not work:

# pfctl -nf /etc/pf.conf
pfctl: the sum of the child bandwidth higher than parent "root_bge1"
# 


Re: ALTQ

2009-04-14 Thread Stuart Henderson
On 2009/04/14 17:37, Helmut Schneider wrote:
> What I want to do is to assign the default queue the whole bandwith 
> (100%) and let e.g. http borrow 5Mb. As I do not know the connection 
> speed (might be 1GB or 100Mb within the local LAN, but might also be 
> 34Mb for the internet) I guess I need to mix absolute values and 
> percentages which I currently fail to implement.

you can't really use altq well where you don't know the connection speed.
to work properly when the line is full, you need to restrict it to the
lowest speed your connection might be running at, and take into account
any other users (unless all traffic on the line is going through this
box).

there are some other things that might apply:

- there may be a disconnect between incoming and outgoing traffic,
maybe the proxy fetches the object at whatever speed it can
and buffers it

- you might not want to throttle sending cached objects to the
lan, only the internet bandwidth

- altq only restricts the speed of outbound traffic

altq running on the proxy may well not be the correct tool for the
job here. maybe squid connection pools, or something else, are more
appropriate. or maybe altq on another machine/cluster (e.g. a
firewall) sitting between the router and the entire network might
be a good choice.



Re: ALTQ

2009-04-14 Thread Robert
On Tue, 14 Apr 2009 17:37:42 +0200
"Helmut Schneider"  wrote:

> From: "Robert" 
> > On Tue, 14 Apr 2009 15:39:48 +0200
> > "Helmut Schneider"  wrote:
> >
> >> From: "Robert" 
> >>> "Helmut Schneider"  wrote:
>  My proxy has one single GB interface and is connected to the
>  internet using a E3-line (34Mb). I want to shape http traffic to
>  5Mb/s. How?
> 
>  Something like:
> 
>  altq on $extIF cbq bandwidth 100% queue { default, http_traf }
>  queue default bandwidth 100% cbq(default borrow)
>  queue http_traf bandwidth 5Mb cbq(borrow)
> 
>  What is the correct syntax?
> 
>  Thanks, Helmut
> >>>
> >>> This is explained (with an example you can adapt) in the PF FAQ.
> >>> http://www.openbsd.org/faq/pf/queueing.html
> >>
> >> No, it's not. The FAQ talks about two interfaces, I only do have
> >> one single interface. I also did not find an example where the
> >> default queue may use 100% percent and HTTP may use lets say 5Mb
> >> from that amount.
> >>
> >> If I'm wrong please point me to the specific location.
> >
> > Doesn't this section explain how to do it?
> > http://www.openbsd.org/faq/pf/queueing.html#assign
> 
> Well, if then I do not understand it. The section states:
> 
> altq on fxp0 cbq bandwidth 2Mb queue { std, ftp }
> queue std bandwidth 500Kb cbq(default)
> queue ftp bandwidth 1.5Mb
> 
> What I want to do is to assign the default queue the whole bandwith
> (100%) and let e.g. http borrow 5Mb. As I do not know the connection
> speed (might be 1GB or 100Mb within the local LAN, but might also be
> 34Mb for the internet) I guess I need to mix absolute values and
> percentages which I currently fail to implement.
> 
> What I tried:
> 
> altq on $extIF cbq bandwidth 100% queue { default, http_traf }
> queue default bandwidth 100% cbq(default borrow)
> queue [default_]http_traf bandwidth 5Mb cbq(borrow)
> 
> which does not work:
> 
> # pfctl -nf /etc/pf.conf
> pfctl: the sum of the child bandwidth higher than parent "root_bge1"
> # 

100% + 5Mb > 100%
All children have to fit into the parent.
(I think its a bad idea to mix % and Mb limits in the same tier of
child-queues.)

And "borrow" allows the child-queue to use more bandwidth than was
defined, if it is available. As your interface has more bandwidth than
your 34Mbit to the internet the queue won't have any effect.
If you want 'http-traf' to get 5Mb max omit the "borrow".

If you only queue traffic to your E3, just set the parent to 34Mb.

- Robert