Configuring squid with DelayPools

From Notes_Wiki

Home > CentOS > CentOS 6.x > Squid proxy server configuration > Configuring squid with DelayPools

To configure squid with DelayPools use:

  1. Setup a squid server or verify that squid is working properly without any DelayPools configuration
  2. Edit squid.conf as follows
    1. Append appropriate number of delay_pools required using:
      delay_pools 3
      Use required number in place of number 3 shown in this example
      A delay pools is basically a category or group of users who are treated in same manner for bandwidth limiting. In an institute with students, faculty, staff, servers and others (miscellaneous), one could have five delay pools, one for each category.
    2. For each of the created delay_pool specify its delay_class, delay_access and delay_parameters and such as:
      #The delay pool-1 is of class 2 for a /24 network.
      delay_class 1 2
      #Allow access to delay pool-1 only to important users
      acl important_users src 192.168.2.0/24
      delay_access 1 allow important_users
      delay_access 1 deny all
      #Overall all important users should be limited to using
      #4mbps (512kBps) of bandwidth. Of this 4mbps also
      #a single user should not get more than 512kbps (64kBps)
      # out of total 4mbps(512kBps) of entire bucket.
      delay_parameters 1 512000/1024000 64000/1024000
      #The second value after / should be at least twice of the limit otherwise limit is halved.
      #Perhaps both input to proxy from Internet server and output to client connecting to proxy
      #are accounted for in delay_pools. Thus keep value before / as the desired rate for individual
      #and value after / as twice of desired ISP usage for group
      #The delay pool-2 is of class 3 for a /16 network
      delay_class 2 3
      #Allow access to delay pool-2 only to hostels
      acl hostels src 10.1.0.0/16
      delay_access 2 allow hostels
      delay_access 2 deny all
      #All students in hostels should be restricted to use of total 20mbps (2500kBps)
      #Each wing a /24 subnet should be restricted to 4mbps (512kBps) usage of total 20mbps
      #Each user should not get more than 512kbps (64kBps) of total 4mbps(512kBps)
      delay_parameters 2 2500000/5000000 512000/5000000 64000/1024000
      #The delay pool-3 is of class 3 for everybody else (guests)
      delay_class 3 3
      #Allow everyone access to guest delay_pool
      delay_access 3 allow all
      #Total bandwidth for guests is limited to 4mbps (512kBps).
      #Of these guests within same /24 subnet should get only 512kbps (64kBps) out of total 4mbps(512 kBps)
      #An individual guest within a /24 subnet should be restricted to 128kbps (16kBps) out of 512kbps (64kBps)
      delay_parameters 3 512000/1024000 64000/1024000 16000/128000
      Refer to http://wiki.squid-cache.org/Features/DelayPools to learn about different delay pool classes.
  3. Restart squid for new settings to take effect. Note that reload is not enough, restart is required after change of delay pools configuration.

For testing delay pools find some large file (say OS ISO) hosted on intranet such that almost unlimited bandwidth is available for its download. Download the file via proxy without any delay pools configuration using wget such as:

wget -c http://test.sbarjatiya.com/test.iso -o test.iso

and verify that full bandwidth is available. Now add delay pool configuration for various users and ask everyone to download the file through proxy and verify that bandwidth limiting is working as expected

Refer http://wiki.squid-cache.org/Features/DelayPools


Home > CentOS > CentOS 6.x > Squid proxy server configuration > Configuring squid with DelayPools