• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Need Help Configuring Limiters with Squid Proxy

Scheduled Pinned Locked Moved Traffic Shaping
17 Posts 6 Posters 3.0k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    tman222
    last edited by Apr 29, 2018, 8:46 PM

    Hi all,

    I wanted to go ahead resurrect this topic since I still have not been able to figure this out unfortunately.  Can anyone give me some advice on the type of rule I would have to setup so limit Squid connection speed to the internet?  As I understand traffic from the LAN is intercepted by Squid and then Squid makes the actual connection outside the network (i.e. to the internet).  I have Squid setup as a transparent proxy. Do I need to create a floating rule for this?  If yes, would the following rule work?

    Floating Rule:
    1)  Action:  Match
    2)  Interface: WAN
    3)  Direction:  Any
    4)  Protocol:  Any
    5)  Source:  LAN segment that has Squid running on it, let's call it LAN1 net
    6)  Destination:  Any
    7)  Then under advanced set in/out pipe to the appropriate limiters/queues created under traffic shaping

    Thanks in advance.

    1 Reply Last reply Reply Quote 0
    • H
      Harvy66
      last edited by Apr 30, 2018, 5:09 PM

      Assuming limiters with Squid works, I would make a limiter that is fq_Codel and force all traffic into it.

      1 Reply Last reply Reply Quote 0
      • T
        tman222
        last edited by Apr 30, 2018, 10:45 PM

        @Harvy66:

        Assuming limiters with Squid works, I would make a limiter that is fq_Codel and force all traffic into it.

        Thanks Harvy66 - I actually already created a limiter and enabled fq_codel on it for the network interface that has Squid running on it.  The problem is if I enable the limiter/queues on the LAN firewall rule for that interface that allows outbound traffic, I just end up limiting the speed from the client to the proxy, but not from the proxy to the internet.  If I wanted to limit to limit the speed of the Squid proxy to the internet, what kind of firewall rule would I have to setup, and where would I setup it up?  Am I on the right track with what I posted above yesterday, or do I need to approach it differently?

        Thanks again for all your help, I really appreciate it.

        1 Reply Last reply Reply Quote 0
        • D
          Derelict LAYER 8 Netgate
          last edited by Apr 30, 2018, 10:59 PM Apr 30, 2018, 10:52 PM

          Floating Rule:
          1)  Action:  Match
          2)  Interface: WAN
          3)  Direction:  Any
          4)  Protocol:  Any
          5)  Source:  LAN segment that has Squid running on it, let's call it LAN1 net
          6)  Destination:  Any
          7)  Then under advanced set in/out pipe to the appropriate limiters/queues created under traffic shaping

          This won't work for two reasons:

          1. Connections to the internet come from squid itself and not anything on Source: LAN Net

          2. Even if the connections were sourced from LAN Net that would not match because NAT has almost certainly already translated the source address of the connection in the outbound direction at the stage that rule is evaluated.

          You might be able to mark specific squid traffic with a QoS marker then match that in the floating rule for putting in the correct pipe/queue:

          https://wiki.squid-cache.org/Features/QualityOfService

          A limiter should be configurable to work for uploads and downloads. Other than that, squid itself would have to limit the download speeds, if that is even possible. Looks like delay pools might do it if they're available.

          Chattanooga, Tennessee, USA
          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
          Do Not Chat For Help! NO_WAN_EGRESS(TM)

          1 Reply Last reply Reply Quote 0
          • T
            tman222
            last edited by Apr 30, 2018, 11:12 PM

            @Derelict:

            Floating Rule:
            1)  Action:  Match
            2)  Interface: WAN
            3)  Direction:  Any
            4)  Protocol:  Any
            5)  Source:  LAN segment that has Squid running on it, let's call it LAN1 net
            6)  Destination:  Any
            7)  Then under advanced set in/out pipe to the appropriate limiters/queues created under traffic shaping

            This won't work for two reasons:

            1. Connections to the internet come from squid itself and not anything on Source: LAN Net

            2. Even if the connections were sourced from LAN Net that would not match because NAT has almost certainly already translated the source address of the connection in the outbound direction at the stage that rule is evaluated.

            You might be able to mark specific squid traffic with a QoS marker then match that in the floating rule for putting in the correct pipe/queue:

            https://wiki.squid-cache.org/Features/QualityOfService

            A limiter should be configurable to work for uploads and downloads. Other than that, squid itself would have to limit the download speeds, if that is even possible. Looks like delay pools might do it if they're available.

            Thanks for the response - I really appreciate it.

            I did a bit more research on the issue - would setting up Delay Pools in Squid also accomplish what a limiter would do (i.e. limiting total bandwidth of the proxy):

            https://wiki.squid-cache.org/Features/DelayPools
            https://forum.pfsense.org/index.php?topic=74595.0

            Thanks again.

            1 Reply Last reply Reply Quote 0
            • D
              Derelict LAYER 8 Netgate
              last edited by Apr 30, 2018, 11:23 PM

              Sorry. Don't know. You'll need to ask in the squid forum.

              Chattanooga, Tennessee, USA
              A comprehensive network diagram is worth 10,000 words and 15 conference calls.
              DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
              Do Not Chat For Help! NO_WAN_EGRESS(TM)

              1 Reply Last reply Reply Quote 0
              • T
                tman222
                last edited by May 1, 2018, 10:47 PM

                @Derelict:

                Sorry. Don't know. You'll need to ask in the squid forum.

                I'll go ahead and do that - thanks again for your help.  I did try out delay pools with Squid, but unfortunately I was only able to limit download bandwidth.  Back to the drawing board….

                1 Reply Last reply Reply Quote 0
                • D
                  Derelict LAYER 8 Netgate
                  last edited by May 2, 2018, 1:17 AM

                  Yeah. upload bandwidth should be able to be limited by marking and matching as explained above.

                  Chattanooga, Tennessee, USA
                  A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                  DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                  Do Not Chat For Help! NO_WAN_EGRESS(TM)

                  1 Reply Last reply Reply Quote 0
                  • P
                    periko
                    last edited by May 14, 2018, 6:39 PM

                    Until now, Traffic Shape/Limiters doesn't work with squid in the same box right?

                    Necesitan Soporte de Pfsense en México?/Need Pfsense Support in Mexico?
                    www.bajaopensolutions.com
                    https://www.facebook.com/BajaOpenSolutions
                    Quieres aprender PfSense, visita mi canal de youtube:
                    https://www.youtube.com/c/PedroMorenoBOS

                    1 Reply Last reply Reply Quote 0
                    • M
                      matt_
                      last edited by May 14, 2018, 6:46 PM

                      I think if you use limiters with floating rules matching on the WAN state creation (out direction) it will limit Squid.  Someone can correct me if I'm totally wrong…

                      1 Reply Last reply Reply Quote 0
                      • M
                        magokbas
                        last edited by May 14, 2018, 7:03 PM

                        manual proxy redirect
                        maybe it might work
                        https://forum.pfsense.org/index.php?topic=147247.0

                        1 Reply Last reply Reply Quote 0
                        • P
                          periko
                          last edited by May 14, 2018, 7:31 PM

                          Need to test again… :)

                          Necesitan Soporte de Pfsense en México?/Need Pfsense Support in Mexico?
                          www.bajaopensolutions.com
                          https://www.facebook.com/BajaOpenSolutions
                          Quieres aprender PfSense, visita mi canal de youtube:
                          https://www.youtube.com/c/PedroMorenoBOS

                          1 Reply Last reply Reply Quote 0
                          • T
                            tman222
                            last edited by May 15, 2018, 10:24 PM

                            Thanks guys for this additional info.  I"d be curious to see if the manual redirect method might work.

                            Hi Matt - if I was to use a floating rule on the WAN interface, what would I use for the source of the traffic?

                            Thanks again.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                              [[user:consent.lead]]
                              [[user:consent.not_received]]