Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 19th May 2010
Lexus45 Lexus45 is offline
Port Guard
Join Date: May 2010
Location: Kurgan, Russia
Posts: 39
Default ALTQ: CBQ issues

Hi guys!
I'm new to OpenBSD but i try to do my best to master this OS and its features.

I have a router which does the shaping to my users. Now it runs Slackware Linux and works very well, but I have an idea to set it using OpenBSD. The root queue is 2 megabits/s and there are about 30 users. Each has 256 kbit/s after I organised the shaping.

I've read carefully an OpenBSD's PF faq, but still have 2 questions. (NOTE: I don't write here some details, like default queue or macroses, because it's not so importnat here)

1. As I create the root queue of 2 mbit/s and have 30 users, 256 kbit/s each, I wrote this:
altq on $int_if cbq bandwidth 2Mb queue {pc2, pc3, pc4 ....... pc31}

 queue pc2 $int_if bandwidth 256Kb cbq
 queue pc3 $int_if bandwidth 256Kb cbq
 queue pc4 $int_if bandwidth 256Kb cbq
 queue pc30 $int_if bandwidth 256Kb cbq

  pass out on $int_if from any to $pc2 queue pc2
  pass out on $int_if from any to $pc3 queue pc3
  pass out on $int_if from any to $pc4 queue pc4
  pass out on $int_if from any to $pc31 queue pc31
The QUESTION: as I understood from the PF's faq, the total sum of queues' bandwidths must be equal to the root queue's bandwidth. But I have 2 megabits/s all in all and 30 users * 0,25 megabits/s = 7,5 megabit/s. What I have to do, if I have only 2 mbit/s link but I'd like to give 256 kbit/s to each my user? I understand that in real life it will be OK, because all 30 users don't use all their 256 kbit/s simultaneously.

2 question. Is it possible to make this ruleset smaller? Or I have to write a line for each queue name and then - for each IP , to assign a queue to it ?
Say, I will not write many lines - a line for each IP, bit if I'll use '' - will the queue be assigned to ALL subnet, or PF will understand my desire to allocate the bandwidth to each IP of this subnet?
queue inet $int_if bandwidth 256Kb cbq
pass out on $int_if from any to queue inet
^^ will this rule give 256 kbit/s to each IP from range or 256 kbit/s for all subnet (so, when several IPs will start to surf the web or download anything, these 256 kbit/s will be allocated among all of them)?

I had the same question while writing the shaping rules in Linux, but didn't find anything and wrote a ruleset with an 'IP rule per line'.

PS: sorry for my English, I'm not a native speaker

Last edited by Lexus45; 4th September 2010 at 08:33 AM.
Reply With Quote
  #2   (View Single Post)  
Old 23rd May 2010
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243

What ho! Welcome!

If all your users are online at the same time pf "should" allocate 30*256Kb for all those clients, if you internet connection is 2Mb then this obviously doesn't make a lot of sense. What should pf do in this case? Or in any case where there are too many clients online using more bandwidth than your internet connection?

Perhaps the borrow and/or upperlimit keywords are of use? Take a look at pf.conf(5) Note that upperlimit is for the hfsc scheduler, not cbq.

I am not sure about your second question, but you can use # pfctl -s rules to see the expanded rules loaded by pf.
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PF w/ ALTQ - Queue errors exceeding bandwidth plexter OpenBSD Security 11 26th October 2008 12:01 AM
PF/ALTQ rules not working as intended Weaseal FreeBSD Security 4 6th August 2008 12:41 PM
ALTQ Question regarding RudiK FreeBSD Security 4 23rd July 2008 01:59 PM
[PF] Problem with ftp and ALTQ gotian FreeBSD Security 1 22nd July 2008 11:25 PM
Queuing with PF and ALTQ Weaseal FreeBSD Security 1 22nd July 2008 05:18 PM

All times are GMT. The time now is 07:15 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick