Tip & How-To about fedora Linux Operating System

How to divide bandwidth in squid

What is Bandwidth throttling :

Consider we are having 512Kbps Internet connection line. And the system administrator wants to divide the whole bandwidth into two sections. Read More One for the normal users and the other for special users who need high speed internet connection. So that all the normal users can use 256 Kbps and the special users can use the remaining 256 Kbps. So in this case you have to make a bandwidth throttling to differentiate the whole single pipe line into two sections. This can be achieved using squid proxy server.

Squid main configuration file ----- /etc/squid/squid.conf
Squid log file ----- /var/log/squid/access.log
Cache log file ----- /var/log/squid/cache.log

Bandwidth throttling in squid is done using Delay Pools. Delay pools uses bucketing system.

Throttle Calculations
512Kbps(Kilo bits per second) -----> 64Kbytes -----> 64000bytes
256Kbps -----> 32Kbytes -----> 32000bytes
128Kbps -----> 16Kbytes -----> 16000bytes
64Kbps -----> 8Kbytes -----> 8000bytes

Points to remember in Delay Pools:
There are basically three things to note, they are - delay pools, delay class, delay parameters.

Delay pool --- Defines how many pools we want to use
Delay Class ---- Defines type of the pool you are going to use.
Delay Parameter � allots the restrictions and fill rate/maximum bucket size.

As I have said previously in this documentation delay pools uses bucketing system.
Now there are three types of buckets

Class 1 pool: A single aggregate bucket, shared by all users
Class 2 pool: One aggregate bucket, 256 individual buckets
Class 3 pool: One aggregate bucket, 256 network buckets, 65,536 individual buckets

If you still have any problem in the above syntax (ie) aggregate, network and individual buckets to understand, then here is a simple syntax/example for all these

For Class 1 delay pool
delay_parameters 1 32000/32000

For Class 2 delay pool
delay_parameters 1 48000/48000 48000/48000

For Class 3 delay pool
delay_parameters 2 32000/32000 8000/8000 16384/16384

Example Setup:
One 512Kbps pipe line. We want to distribute the whole pipe line into 2. One for normal users and other for special users as follows
Normal users --- 128 Kbps
Special Users --- 384 Kbps

Configuration Setup File /etc/squid/squid.conf:
Before getting into the delay pools setup first create the acl(Access Control List). Through acl you can define rules according to your requirements. Find the Access Control section in the squid.conf file.
Here is an example:

acl superusers src 192.168.1.1 192.168.1.2 192.168.1.3
acl mynetwork src 192.168.1.0/255.255.255.0

Here in the above example only three users are special users who need 256Kbps bandwidth which are listed in the specialusers label and the whole network including he special users are labeled as mynetwork.

After creating the users you have to allow them to access the internet. Below line specifies for allowing the mentioned labeled users.

http_access allow superusers
http_access allow mynetwork

Now comes the funny part Delay Pools. Here We will deal with a basic example for delay pools.

The example is as follows: We are having 512Kbps pipe line connection. We want to divide it into segments one for the special users, web servers and the other for the normal users in the organization. The special users and the web servers are given 384Kbps speed and the remaining 128Kbps for the normal users.

Delay Pools for super users:
Check for the delay pools section in the squid.conf file.
Start the configuration for delay pools as follows
==================================
########## Delay Pools############
==================================

delay_pools 2

As described above we have to create 2 delay pools, one for each delay class.
====================================================
######### Defining Delay pool 1 in class 2 #########
====================================================

delay_class 1 2
delay_parameters 1 48000/48000 48000/48000
delay_access 1 allow superusers

The first line specifies Delay Class which defines delay pool 1 for the delay class 2.

Why we are using delay class 2 here?

The first part on the second line ie �1� defines the pool One(1)

The second part on second line defines the aggregate 48000/48000(restore/max). where restore is the number of bytes (not bits - modem and network speeds are usually quoted in bits) per second placed into the bucket, and maximum is the maximum number of bytes which can be in the bucket at any time.

The third part on second line is individual buckets again 48000/48000(restore/max). All the special users and the web servers should obtain the same speed of 384 Kbps.

The third line allows the super users to fall in that bucket.

=====================================================
######### Defining Delay pool 2 in class 3 #########
=====================================================

Delay Pools for normal users:

delay_class 2 3
delay_parameters 2 32000/32000 8000/8000 16384/16384
delay_access 2 allow !superusers

The first line specifies Delay Class which defines delay pool 2 for the delay class 3.

The first part on the second line ie �2� defines the pool Two(2) of class three(3)

The second part on second line defines the aggregate 32000/32000(restore/max) as aggregate (ie for whole).
Note : - If you use -1/-1. �-1� indicates �unlimited�.

The third part on second line is network bucket. We have defined here 8000/8000 .

The fourth part on second line is for individual.

The third line specifies to throttle all the users except the super users.

How to check:
First set proxy settings in your browser as follows:
Go to any client machine and open an IE(Internet Explorer). Select "Tools" menu then select "Internet Options" then select "Connections" tab. After that select the "LAN Settings" button, you will get a new pop-up window there you select "Use proxy server for your LAN" check box and finally give your squid proxy servers ip address and the port on which the squid proxy server is configured. Now press "OK" and again press "OK". Cloase the window and now open a new window.
Second Check by downloading any large file

Start to download any lage file not less than 10MB size. Because when ever you download any small file it used to download it quickly. When you start downloading large file at first if you note some starting bytes of the file gets downloaded quickly and later it gets slowed down.

Keep a note on the download pop-up box which shows the speed limits in "kbps". When we start downloading note on the pop-up box the speed limits in kbps shows high value and then slowly gets decreased. This means when you start downloading the bucket gets filled and slowly it decreases and becomes stable to the specified limit in Kbps according to the configuration. Remember again as i told restore value is used to set the download speed, and the max value lets you set the size at which the files are to be slowed down from.

Posted by on

fedora Linux Operating System Logo

Related Topics:

Related Questions:

1 Answer

poor streaming of Livestation for BBC and CNN.


try that trick it will make your whole band width larger faster f you have XP Pro:

- click start > run - enter "gpedit.msc" and hit ok - go to computer configuration > administrative templates > network - click the folder "QoS Packet Scheduler" - right-click "Reservable Bandwidth", select properties - Change it from "Not Configured" to "Enabled" and set your bandwidth limit to "0" - Select OK
- Go to "My Network Places", then "View Network Connections" - Right-click your internet connection you want this to work for and select Properties. - Make sure "QoS packet Scheduler" is checked off.
- Close everything and restart your computer.
Now you have 20% more of your available bandwidth to use.

May 28, 2011 | Computers & Internet

1 Answer

What does QUAD BRI stand for?


It means that there are four ISDN BRI S/T interfaces on the device. Each BRI line contains two phone numbers at 64Kbps of bandwidth each so the Quad BRI would supply 128Kbps x 4 or 512Kbps of bandwidth.

Feb 09, 2011 | Polycom Quad Bri Module for VSX7000S & Vsx...

2 Answers

the internet speed is slow.. connection is in & out


Hi there,

Here's another one.. to take the 20% bandwidth Windows is stealing from you. You'll love it! This guide teaches you to counter one of the main problems any Internet User may face - Slow Internet Speed! As simple it sounds, its as simple to increase it!
addthis_url = location.href; addthis_title = document.title; addthis_pub = 't1ma';
1) Go to Start>Run. Type in “gpedit.msc” (Without the quotes, duh!). (This opens a “Group Policy” window. If you're like me, you wont be interested in what it actually is, but what it can actually do for you.. Right? Anyways..)

2) Follow this path: Local Computer Policy>Computer Configuration>Administrative Templates>Network>QoS Packet Scheduler>Limit Reservable Bandwidth>. If it's disabled or not configured, change the settings like the one below: bandwith.jpg


Like the above screenshot indicates, select "Enabled" and set the Bandwitdth limit to 0%.
Why did we do that? Simple, like I said before, Windows is silently eating 20% of your bandwidth. I emphasize on the word “silently” - The explain TAB of the above window proves it. This is what it says:


Determines the percentage of connection bandwidth that the system can reserve. This value limits the combined bandwidth reservations of all programs running on the system.
By default, the Packet Scheduler limits the system to 20 percent of the bandwidth of a connection, but you can use this setting to override the default.
If you enable this setting, you can use the "Bandwidth limit" box to adjust the amount of bandwidth the system can reserve.
If you disable this setting or do not configure it, the system uses the default value of 20 percent of the connection.
Important: If a bandwidth limit is set for a particular network adapter in the registry, this setting is ignored when configuring that network adapter.

Warm regards,

Anirban Mazumdar

Nov 05, 2009 | Computers & Internet

Not finding what you are looking for?

586 people viewed this tip

Ask a Question

Usually answered in minutes!

Top fedora Computers & Internet Experts

alex metro
alex metro

Level 3 Expert

331 Answers

Pieter Vleeshouwers
Pieter Vleeshouwers

Level 3 Expert

1826 Answers

tdk1988

Level 2 Expert

121 Answers

Are you a fedora Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Loading...