Netgate SG-1000 microFirewall

Author Topic: squid extra delay pools - Limiting Youtube bandwidth  (Read 20206 times)

0 Members and 1 Guest are viewing this topic.

Offline bellera

  • Hero Member
  • *****
  • Posts: 5569
  • Karma: +117/-51
    • View Profile
squid extra delay pools - Limiting Youtube bandwidth
« on: April 04, 2014, 10:28:42 am »
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

Code: [Select]
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):

Code: [Select]
# 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
« Last Edit: April 04, 2014, 10:37:25 am by bellera »

Offline pepe_reis

  • Newbie
  • *
  • Posts: 1
  • Karma: +1/-0
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #1 on: April 07, 2014, 10:06:19 am »
Thanks!

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


P.D. Des de Badalona city ;)
« Last Edit: April 07, 2014, 10:17:45 am by pepe_reis »

Offline bellera

  • Hero Member
  • *****
  • Posts: 5569
  • Karma: +117/-51
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #2 on: April 07, 2014, 11:53:43 am »
At Console or at WebGUI: Diagnostics: Execute command

Code: [Select]
$ find / -name squid.conf
/usr/pbi/squid-amd64/etc/squid/squid.conf
/usr/pbi/squidguard-squid3-amd64/etc/squid/squid.conf

or

Code: [Select]
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

Offline bellera

  • Hero Member
  • *****
  • Posts: 5569
  • Karma: +117/-51
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #3 on: April 08, 2014, 05:11:55 am »
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:

Code: [Select]
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.

Offline bellera

  • Hero Member
  • *****
  • Posts: 5569
  • Karma: +117/-51
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #4 on: April 08, 2014, 01:08:16 pm »
Adding LAN Address to Proxy server: Cache management: External Cache-Managers permits to work with squidclient and see delay pools state

Code: [Select]
[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

Offline bellera

  • Hero Member
  • *****
  • Posts: 5569
  • Karma: +117/-51
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #5 on: April 08, 2014, 02:05:29 pm »
Modifying squid.inc code solves (of course) the warning:
Code: [Select]
diff squid.inc squid.inc-2014-04-08
1506c1506
< delay_pools 2
---
> delay_pools 1

So, at Custom Options, no delay_pools line:
Code: [Select]
# 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
Code: [Select]
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.
« Last Edit: May 14, 2014, 09:02:44 am by bellera »

Offline bellera

  • Hero Member
  • *****
  • Posts: 5569
  • Karma: +117/-51
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #6 on: April 08, 2014, 02:21:37 pm »
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...
« Last Edit: April 08, 2014, 02:24:34 pm by bellera »

Offline cheonne

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +2/-0
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #7 on: May 14, 2014, 12:31:57 am »
hi bellera, is this working on https://www.youtube.com?

Offline bellera

  • Hero Member
  • *****
  • Posts: 5569
  • Karma: +117/-51
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #8 on: May 14, 2014, 01:41:29 am »
Reverting to first solution...

First solution it works.

Offline cheonne

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +2/-0
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #9 on: May 14, 2014, 07:36:33 am »
what you mean by first solution sir?
is it default settings in delay pools ("1") without hacking in squid.inc to "2"? thanks

Offline bellera

  • Hero Member
  • *****
  • Posts: 5569
  • Karma: +117/-51
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #10 on: May 14, 2014, 09:09:48 am »
From...

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...

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

Offline pfirewa

  • Jr. Member
  • **
  • Posts: 25
  • Karma: +1/-0
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #11 on: July 14, 2014, 01:39:07 pm »
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?
 

Offline alextech0x

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #12 on: May 20, 2015, 08:26:15 pm »
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):

Code: [Select]
# 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?

Offline geovaneg

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #13 on: July 25, 2016, 12:53:18 pm »
Thanks for de big tip ! For my transparent mode config works fine.


Geovane

Offline xainx

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: squid extra delay pools - Limiting Youtube bandwidth
« Reply #14 on: November 15, 2016, 07:34:49 pm »
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

Code: [Select]
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):

Code: [Select]
# 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

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