View Single Post
  #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:
Code:
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 '10.84.27.0/24' - will the queue be assigned to ALL subnet, or PF will understand my desire to allocate the bandwidth to each IP of this subnet?
Quote:
queue inet $int_if bandwidth 256Kb cbq
pass out on $int_if from any to 10.84.27.0/24 queue inet
^^ will this rule give 256 kbit/s to each IP from 10.84.27.0/24 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