Rein In Your Bandwidth Hogs with Squid Proxying - Page 2

By Carla Schroder | Posted May 12, 2004
Page 2 of 2   |  Back to Page 1
Print ArticleEmail Article
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
Continued From Page 1

Individual Restrictions
Class 2 pools are perfect for limiting individual users on small 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:

delay_parameters 1 5000/10000  5000/7500

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_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. This selects 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. Which I'll write about someday.

PS: I must extend sincere apologies to hogs, who are fine, intelligent, tasty critters, and better company than a lot of people I can think of.

Resources

Comment and Contribute
(Maximum characters: 1200). You have
characters left.
Get the Latest Scoop with Enterprise Networking Planet Newsletter