LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-21-2010, 02:34 AM   #1
vijith.pa@gmail.com
LQ Newbie
 
Registered: Feb 2009
Posts: 26

Rep: Reputation: 0
Question Limit the bandwidth used by an IP Address in Squid3(Ubuntu 10.04)


hai guys,
i configured Squid3 server in my Ubuntu 10.04.Now the ip based and content based blocking is working fine.Now i want to configured bandwidth allocation of ip address and group ip address..pls give the solution

with regards
Vijtih P A
 
Old 09-21-2010, 02:50 AM   #2
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Thumbs up

For this you have to user Bandwidth Throttling in Squid.

It is done using Delay Pools. Delay pools uses bucketing system.

Quote:
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.
Quote:
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
Quote:
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:

Quote:
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

Code:
 /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:

Code:
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.

Code:
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############
==================================

Code:
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 #########
====================================================

Code:
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 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:

Code:
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 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).

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).

Quote:
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". Close 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.

Last edited by prayag_pjs; 09-21-2010 at 06:02 AM.
 
Old 09-21-2010, 05:41 AM   #3
vijith.pa@gmail.com
LQ Newbie
 
Registered: Feb 2009
Posts: 26

Original Poster
Rep: Reputation: 0
thanks prayag........
i have one doubt remaining...
whether it will effect speed of LAN Copying (System to system)?
 
Old 09-21-2010, 05:45 AM   #4
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
No it should not affect.Squid controls HTTP traffic
 
Old 09-21-2010, 05:59 AM   #5
vijith.pa@gmail.com
LQ Newbie
 
Registered: Feb 2009
Posts: 26

Original Poster
Rep: Reputation: 0
Exclamation

hai prayag,

can u explain detail in "delay_parameters 2 32000/32000 8000/8000 16384/16384"

i think 32000/32000 is aggregate speed
16384/16384 is a normal user speed

whatz that 8000/8000?
 
Old 09-21-2010, 06:04 AM   #6
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
The third part on second line is network bucket. We have defined here 8000/8000 . Its used just for example.
 
Old 09-21-2010, 06:46 AM   #7
leejohnli
Member
 
Registered: Sep 2010
Posts: 66

Rep: Reputation: 2
Hi,
How do you define on squid if i want to delay pool using Class 1 pool: A single aggregate bucket, shared by all users. Tnx
 
Old 09-21-2010, 06:51 AM   #8
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Hi,

Above example was for reference you have to refer it and try the configurations yourself fist then if you face any problem in installing the services,we are here to help you.

Also do Googling for getting the concepts clear.Learn by doing practically the above configuration.
 
Old 09-21-2010, 09:14 AM   #9
vijith.pa@gmail.com
LQ Newbie
 
Registered: Feb 2009
Posts: 26

Original Poster
Rep: Reputation: 0
hai prayag,
here i implement bandwidth allocation in My Company....
Butz not loading even google page

My configuration
ACl Conf
acl superusers src 192.168.1.100 192.168.1.6 192.168.1.3
acl lan src 192.168.1.0/24
http_access allow superusers
http_access allow lan
delay pool conf
delay_pools 2
delay_class 1 2
delay_parameters 1 150000/150000 150000/150000
delay_access 1 allow superusers
delay_class 2 3
delay_parameters 2 110000/110000 8000/8000 100000/100000
delay_access 2 allow !superusers

Net details 2Mbps connection
super user can download limit upto 1.2Mbps normal user 800Kbps
whether my configuration is correct?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit Bandwidth as Data Volume Approaches Limit sweno Linux - Server 1 06-12-2008 08:10 AM
How do I limit my bandwidth from the PC? koobi Linux - Networking 3 06-07-2008 05:34 AM
Squid3 on Ubuntu TCP_MISS sscultima Ubuntu 2 01-08-2008 05:28 AM
Squid3 on Ubuntu Server 7.04 sscultima Ubuntu 9 08-13-2007 11:15 AM
Vsftpd - how to limit download bandwidth but unlimited upload bandwidth? mpls mikeg Linux - Software 3 08-13-2005 02:52 PM


All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration