Re: [squid-users] Limit bandwidth - Delay pools and ACL ...

From: Leonardo Rodrigues Magalhães <leolistas@dont-contact.us>
Date: Wed, 10 Dec 2003 13:37:16 -0300

    If you ONLY wanna to limit downloads coming from servers located on
iprange1 AND with some extensions, and leaving the rest unlimited, we can
surely forget about specifying iprange2, as iprange2 would fall in the
'default' no restrict action. I think you can achieve this using: (untested
rules, may have sintax errors)

acl dst_ip_range_1 dst 192.168.0/255.255.255.0
acl all src 0.0.0.0/0.0.0.0 # please check, it may be already defined in
your squid.conf
acl magic_words_files url_regex -i
"/path/to/somewhere/file-extensions.txt"

(and create the file-extensions.txt with)
--- begin of file-extensions.txt ---
\.exe$
\.mp3$
\.ace$
\.avi$
\.mpeg$
\.mpe$
\.mpg$
\.qt $
\ .ram$
\.rm$
\.rvb$
\.iso$
\.bin$
\.raw$
\.wav$
\.mov$
--- end of file-extensions.txt ---

    having a separate file is cool because you can add/remove extensions
without having to modify squid.conf (less chance of screwing things up).
Please note that a 'squid -k reconfigure' will be needed after changes have
been made on the file-extensions.txt

$ means 'ends with' ..... so the rule WILL match
'http://www.something.com/file.avi" but would NOT match
http://www.avicult.com/something/, which would be matched if you use only
'.avi'.

-i in the acl means 'case unsensitivite'. It will match
http://www.something.com/file.avi as well as
http://www.something.com/file.AVI

    and the delay pool config would like ......

# we just need 1 delay_pool
delay_pools 1
# of class 2
delay_class 1 2
# with global inlimited but with 8Kbyte/s (64Kbit/s) per IP with same speed
for burst
delay_parameters 1 -1/-1 8192/8192
# downloads that match either dst_ip_range_1 AND magic_words_files WILL have
the speed restricted
delay_access 1 allow dst_ip_range_1 magic_words_files
# ALL others will NOT have speed restrictions by this bucket
delay_access 1 deny all

    Well ....... configs here may be wrong, but I think they will help you
to figure out how things work :) I hope this at least helps you.

    Sincerily,
    Leonardo Rodrigues

----- Original Message -----
From: "Olivier BELLON" <Olivier.BELLON@ima.uco.fr>
To: <squid-users@squid-cache.org>
Sent: Wednesday, December 10, 2003 11:57 AM
Subject: [squid-users] Limit bandwidth - Delay pools and ACL ...

>
> I'm having some troubles about the use of "Delay pools" and "Delay Acess"
ACL.
> How could I limit the use of the bandwidth (64 KB per IP) if some types of
> files are downloaded from a specified IP range "ip_range_1".
> Other downloads from this IP range "ip_range_1" are unlimited and
downloads
> from an other IP range "ip_range_2" are unlimited.
>
> So i have the following magic_words :
>
> acl magic_words_etud url_regex -i 192.168.0
> acl magic_words_perm url_regex -i 192.93.219
> acl magic_words_files url_regex -i .exe .mp3 .ace .avi .mpeg .mpe .mpg .qt
> .ram .rm .rvb .iso .bin .raw .wav .mov
>
> I think I must use a class 2 of delay pool and and the delay parameters
> could contain "-1/-1 64000/64000" for the limited download and "-1/-1
> -1/-1" for the unlimited.
> But, i'm unable to write properly the good "delay_access" acl.
>
> Some help will greatly apreciated :o)
Received on Wed Dec 10 2003 - 08:39:02 MST

This archive was generated by hypermail pre-2.1.9 : Thu Jan 01 2004 - 12:00:09 MST