CBQ

From StarOS Community Wiki
Revision as of 17:28, 27 November 2006 by Tcw.wisp (talk | contribs)
Jump to navigation Jump to search

qshape

Assuming you have a working StarOS AP setup with associated clients.

1. Using putty, log-in to your StarOS router. 2. Click Advanced > Scripts > class based queuing (cbq / bw management)

First you will need to set some variables...

  • Net will equal your router's gateway interface.
  • Client will equal the interface to which your clients (customers) associate.

These values could be… ether (Ethernet), wpci (mini pci), or wlan (pcmcia) interfaces; this will depend on your specific configuration.

Let's assume “net” is your ether1 and your clients connect to wpci1.

Indicate which interface is net and which interface is client

3. at the top of the script type...


net = ether1

client = wpci1


  • anything preceding the “#” symbol will be ignored. When adding rules, make sure you do not have the “#” symbol at the beginning.

Now you can start limiting your customer’s bandwidth speeds by adding a simple qshape script.

First you should understand some of the commands and what they mean.

StarOS simple qshape example: qshape user 100 bw 128k 56k 192.168.10.1 on $client

qshape = The qshape command user = The user name you have specified for the customer. This value can be anything you want. 100 = Bandwidth pipe number. In this instructional each customer will get their own unique pipe. bw 128k 56k = Bandwidth equals 128kbps download and 56kbps upload. The speeds can be anything you want, but the syntax has to be as displayed in the example. 192.168.10.1 = The IP address of the customer’s PC/Router that you are wanting to qshape. on = This is self explanatory. $client = This is the interface that the client is associated. The "$" symbol indicates that this value has been bound.

Now you are ready to start limiting your customer’s download and upload speeds.

4. Go to the next available line and type…


qshape asmith 100 bw 1024k 512k 192.168.10.1 on $client


  • this qshape rule indicates that asmith’s pipe (pipe 100) has been limited to 1mbps download / 512kbps upload. His PC/Router’s IP address is 192.168.10.1, and his CPE is associated to your AP’s wpci1 interface.

Let’s do another customer. This customer has two static IP addresses. We need to limit both addresses to the same pipe so that they do not go over their allocated bandwidth.

5. Go to the next available line and type…


qshape bsmith 101 bw 2048k 1024k 192.168.10.2 on $client

qshape bsmith 101 192.168.10.3 on $client


  • this qshape rule indicates that Bob Smith’s pipe (pipe 101) has been limited to 2mbps download / 1mbps upload. Both of this customer’s IP address share pipe 101’s total bandwidth.

When we combine what we have done so far, your cbq script should look like this…


net = ether1

client = wpci1


qshape asmith 100 bw 1024k 512k 192.168.10.1 on $client

qshape bsmith 101 bw 2048k 1024k 192.168.10.2 on $client

qshape bsmith 101 192.168.10.3 on $client


Other variables can be set to make life easier, for example:


lite = “bw 512k 128k”

basic = “bw 1024k 512k”

plus = “bw 1024k 1024k”

premium = “bw 2048k 1024k”


With this variables set, your rules would now read…


qshape asmith 100 $basic 192.168.10.1 on $client

qshape bsmith 101 $premium 192.168.10.2 on $client

qshape bsmith 101 192.168.10.3 on $client


Or you could qshape an entire subnet to a specific pipe.


qshape csmith 102 $plus 10.128.0.1/24 on $client


Our new script looks like this…


net = ether1

client = wpci1


lite = “bw 512k 128k”

basic = “bw 1024k 512k”

plus = “bw 1024k 1024k”

premium = “bw 2048k 1024k”

qshape asmith 100 $basic 192.168.10.1 on $client

qshape bsmith 101 $premium 192.168.10.2 on $client

qshape bsmith 101 192.168.10.3 on $client

qshape csmith 102 $plus 10.128.0.1/24 on $client


Hopefully this will make qshaping a little more clearly, and give you a head-start with more advanced shaping scripts.

Oh, and never ever activate a script until you have checked your syntax. Just click the button that says "syntax check"