SHARE
Facebook X Pinterest WhatsApp

Reining in Bandwidth With Squid Proxying Page 2

Written By
thumbnail Carla Schroder
Carla Schroder
Jul 20, 2010
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



Individual Restrictions

Class 2 pools are perfect for limiting individual users on networks with fewer than 255 users. This creates a cap of 512 Kbit/s on the pool, and 128 Kbit/s on individual users, with a 2048 Kbit/s reserve:

########Delay Pools#########
delay_pools 1
delay_class 1 2
delay_parameters 1 64000/64000   16000/256000
acl All src 0/0
delay_access 1 allow All

You don’t have to use multiples of 8, you can use any numbers of bytes:

Excluding Local Traffic

It’s unlikely that you’ll want to place restrictions on LAN traffic, so let’s exclude it. It needs its own pool, so define two pools:

delay_parameters 1 5000/10000  5000/7500

delay_pools 2
#pool 2, don't restrict LAN traffic
delay_class 1 2
#no bandwidth restrictions
delay_parameters 1 -1/-1 -1/-1
acl localUsers url_regex -i 192.168
delay_access 1 allow localUsers

Creating a Privileged Class

Yes, you can play favorites and grant some users more bandwidth by selecting a specific range of IPs. You may use dotted quad, CIDR, or hostnames. You don’t have to specify a netmask, Squid will try to calculate it, but it’s a good idea to use one anyway:

########Delay Pools#########
delay_class 1 1
delay_class 2 1
delay_parameters 1 64000/128000
delay_parameters 2 2048/64000
acl myFriends src 192.168.8.25-192.168.8.35/32
acl All src 0/0
delay_access 1 allow myFriends
delay_access 2 allow All

And there you are, playing favorites to your heart’s content. Squid comes with a monitoring utility so you can see how things are working:

# squidclient mgr:delay | less

Bigger, Faster, Stronger

If your needs are more complex, you’re probably better off biting the bullet, and learning to implement tc or rshaper.

Resources

This article was originally published ServerWatch on May 21, 2004. Prior to that it was published on Enterprise Networking Planet.

thumbnail Carla Schroder

Carla Schroder is a ServerWatch contributor.

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
What Is a Network Policy Server (NPS)? | Essential Guide
Virtual Servers vs. Physical Servers: Comparison and Use Cases
Ray Fernandez
Nov 14, 2023
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.