Squid extra delay pools - Limiting Youtube bandwidth



  • Tested with squid3-dev 3.3.10 pkg 2.2.1 not transparent (intercept) mode

    I need to limit the use of Youtube at my main installation.

    Nothing configured at Proxy server: Traffic management, so the defaults at squid.conf

    request_body_max_size 0 KB
    delay_pools 1
    delay_class 1 2
    delay_parameters 1 -1/-1 -1/-1
    delay_initial_bucket_level 100
    delay_access 1 allow allsrc
    

    I added, at Custom Options,  the following lines (Youtube serves now the videos from googlevideo.com domain):

    # Limiting YOUTUBE at 8 * 512.000 Byte/s = 4.096.000 bit/s = 4 Mbit/s
    delay_pools 2
    delay_class 2 1
    delay_parameters 2 512000/512000
    acl YOUTUBE dstdomain .googlevideo.com
    delay_access 2 allow YOUTUBE
    

    I went to www.youtube.com and searched for long videos

    I opened many (4-5) long videos at the same time. It worked!

    I did changes to 256000/256000 (2 Mbit/s) and it worked!

    I reconfigured a new time with 512000/512000 (4 Mbit/s) and it worked!

    Please see the attached image. I think bandwidth 4 Mbit/s and 2 Mbit/s is bigger because in fact I'm monitoring my VPN connection.

    I made the testing from road warrior at home using the proxy at job. Nobody at job. :) :) :)

    Problem

    • squid.conf has two lines delay_pools (one from default configuration, other from my Custom Options).
    • But it seems not to be important.
    • Old discussion about extra delay pools, https://forum.pfsense.org/index.php?topic=41516.0
      ![Captura de 2014-04-04 16:56:59.png](/public/imported_attachments/1/Captura de 2014-04-04 16:56:59.png)
      ![Captura de 2014-04-04 16:56:59.png_thumb](/public/imported_attachments/1/Captura de 2014-04-04 16:56:59.png_thumb)


  • Thanks!

    One question… Where is the squid.conf file??

    P.D. Des de Badalona city ;)



  • At Console or at WebGUI: Diagnostics: Execute command

    $ find / -name squid.conf
    /usr/pbi/squid-amd64/etc/squid/squid.conf
    /usr/pbi/squidguard-squid3-amd64/etc/squid/squid.conf
    

    or

    ps aux | grep squid
    

    The used squid.conf is /usr/pbi/squid-amd64/etc/squid/squid.conf

    If you have squidGuard installed you can see squid.conf at Proxy filter SquidGuard: Log page: Proxy config



  • @bellera:

    Problem

    • squid.conf has two lines delay_pools (one from default configuration, other from my Custom Options).
    • But it seems not to be important.

    At cache.log it says:

    2014/04/08 11:38:55 kid1| parse_delay_pool_count: multiple delay_pools lines, aborting all previous delay_pools config
    

    Limited bandwidth for Youtube is working, however.



  • Adding LAN Address to Proxy server: Cache management: External Cache-Managers permits to work with squidclient and see delay pools state

    [2.1-RELEASE][admin@proxy.mydomain.tld]/root(45): squidclient -h proxy.mydomain.tld mgr:delay
    HTTP/1.1 200 OK
    Server: squid/3.3.10
    Mime-Version: 1.0
    Date: Tue, 08 Apr 2014 18:01:38 GMT
    Content-Type: text/plain
    Expires: Tue, 08 Apr 2014 18:01:38 GMT
    Last-Modified: Tue, 08 Apr 2014 18:01:38 GMT
    X-Cache: MISS from proxy.mydomain.tld
    X-Cache-Lookup: MISS from proxy.mydomain.tld:3128
    Via: 1.1 proxy.mydomain.tld (squid/3.3.10)
    Connection: close
    
    Delay pools configured: 2
    
    	Misconfigured pool.
    
    Pool: 2
    	Class: 1
    
    	Aggregate:
    		Max: 512000
    		Restore: 512000
    		Current: 417287
    
    Memory Used: 760 bytes
    

    About squidclient, https://forum.pfsense.org/index.php?topic=74816.msg408690#msg408690



  • Modifying squid.inc code solves (of course) the warning:

    diff squid.inc squid.inc-2014-04-08
    1506c1506
    < delay_pools 2
    ---
    > delay_pools 1
    

    So, at Custom Options, no delay_pools line:

    # Limiting YOUTUBE at 8 * 512.000 Byte/s = 4.096.000 bit/s = 4 Mbit/s
    delay_class 2 1
    delay_parameters 2 512000/512000
    acl YOUTUBE dstdomain .googlevideo.com
    delay_access 2 allow YOUTUBE
    

    squidclient -h proxy.mydomain.tld mgr:delay

    Delay pools configured: 2
    Pool: 1
    	Class: 2
    	Aggregate:
    		Disabled.
    	Individual:
    		Disabled.
    Pool: 2
    	Class: 1
    	Aggregate:
    		Max: 512000
    		Restore: 512000
    		Current: 512000
    

    It would be a good option to have a box for indicating the number of delay pools desired.



  • Oops!

    It doesn't works. It seems that default delay pool with unlimited bandwidth causes my delay pool for YOUTUBE not to work.

    Reverting to first solution…



  • hi bellera, is this working on https://www.youtube.com?



  • @bellera:

    Reverting to first solution…

    First solution it works.



  • what you mean by first solution sir?
    is it default settings in delay pools ("1") without hacking in squid.inc to "2"? thanks



  • From…

    @bellera:

    Tested with squid3-dev 3.3.10 pkg 2.2.1 not transparent (intercept) mode

    I need to limit the use of Youtube at my main installation.

    To…

    @bellera:

    About squidclient, https://forum.pfsense.org/index.php?topic=74816.msg408690#msg408690



  • bom dia
    good day

    I need your help

    I have a link of 10MB and want to separate the network 192.168.1.0/24 4Mb link to the extensions specified here and the youtube site:

    (./..(avi|mpg|mpeg|mpe|m1v|m2v|mpv2|mp2v|pva|evo|m2p|ts|tp|trp|m2t|m2ts|mts|rec|vob|ifo|mkv|webm|mp4|m4v|mp4v|mpv4|hdmov|mov|3gp|3gpp|swf|3ga|3g2|3gp2|flv|f4v|ogm|ogv|rm|ram|rt|rp|rmm|wmv|wmp|wm|asf|smk|bik|fli|flc|flic|dsm|dsv|dsa|dss|ivf|d2v|divx|rmvb|amv|ac3|dts|aif|aifc|aiff|alac|amr|ape|apl|au|snd|cda|flac|m4a|m4b|m4r|aac|mid|midi|rmi|mka|mp3|mpa|mp2|m1a|m2a|mpc|ofr|ofs|ogg|oga|opus|ra|tak|tta|wav|wma|wv|aob|mlp|asx|m3u|m3u8|pls|wvx|wax|wmx|mpcpl|mpls|bdmv|vbr|wmv8|psp|mpg1|mpg2|mpeg-4|mpeg4|flv|f4v|swf))

    how to do it?



  • @bellera:

    Tested with squid3-dev 3.3.10 pkg 2.2.1 not transparent (intercept) mode

    I need to limit the use of Youtube at my main installation.

    I added, at Custom Options,  the following lines (Youtube serves now the videos from googlevideo.com domain):

    # Limiting YOUTUBE at 8 * 512.000 Byte/s = 4.096.000 bit/s = 4 Mbit/s
    delay_pools 2
    delay_class 2 1
    delay_parameters 2 512000/512000
    acl YOUTUBE dstdomain .googlevideo.com
    delay_access 2 allow YOUTUBE
    

    Mr, Can i set the same configuration for different sites or do i have to do it all in the same line?
    Thank you!
    What would be the best way to check this?



  • Thanks for de big tip ! For my transparent mode config works fine.

    Geovane



  • @bellera:

    Tested with squid3-dev 3.3.10 pkg 2.2.1 not transparent (intercept) mode

    I need to limit the use of Youtube at my main installation.

    Nothing configured at Proxy server: Traffic management, so the defaults at squid.conf

    request_body_max_size 0 KB
    delay_pools 1
    delay_class 1 2
    delay_parameters 1 -1/-1 -1/-1
    delay_initial_bucket_level 100
    delay_access 1 allow allsrc
    

    I added, at Custom Options,  the following lines (Youtube serves now the videos from googlevideo.com domain):

    # Limiting YOUTUBE at 8 * 512.000 Byte/s = 4.096.000 bit/s = 4 Mbit/s
    delay_pools 2
    delay_class 2 1
    delay_parameters 2 512000/512000
    acl YOUTUBE dstdomain .googlevideo.com
    delay_access 2 allow YOUTUBE
    

    I went to www.youtube.com and searched for long videos

    I opened many (4-5) long videos at the same time. It worked!

    I did changes to 256000/256000 (2 Mbit/s) and it worked!

    I reconfigured a new time with 512000/512000 (4 Mbit/s) and it worked!

    Please see the attached image. I think bandwidth 4 Mbit/s and 2 Mbit/s is bigger because in fact I'm monitoring my VPN connection.

    I made the testing from road warrior at home using the proxy at job. Nobody at job. :) :) :)

    Problem

    Hello
    Thank you for this post!
    I am having trouble assigning this setting for a specific range. what do you think my problem is?

    Here is my setting

    acl user_group_1 192.168.1.20-192.168.1.90
    delay_pools 2
    delay_class 2 1
    delay_parameters 2 512000/512000
    acl YOUTUBE dstdomain .googlevideo.com
    delay_access 2 allow YOUTUBE
    delay_access 2 allow user_group_1



  • Excelente, sirvio para 2.4.2

    Excellent, it works on 2.4.2


Log in to reply