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

    How-To: 2.0 Load-Balance + Transparent Squid (3 easy steps)

    Scheduled Pinned Locked Moved Routing and Multi WAN
    36 Posts 20 Posters 46.6k 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.
    • G
      Gradius
      last edited by

      Avoid postimage.org it will never works!

      Use tinypic instead.

      1 Reply Last reply Reply Quote 0
      • pttP
        ptt Rebel Alliance
        last edited by

        Here are the images:

        Step 1:
        Create your Gateway Group. Put all your WAN's in Tier1 (Load-Balance)

        Gateway_Groups_Tier1.png
        Gateway_Groups_Tier1.png_thumb

        1 Reply Last reply Reply Quote 0
        • pttP
          ptt Rebel Alliance
          last edited by

          Step 2:
          Create a Floating Rule that looks like this:

          Floating_Rule1.png
          Floating_Rule1.png_thumb
          Floating_Rule2.png
          Floating_Rule2.png_thumb

          1 Reply Last reply Reply Quote 0
          • pttP
            ptt Rebel Alliance
            last edited by

            It should look like this after you saved it:

            Floating_Rule1_Overview.png
            Floating_Rule1_Overview.png_thumb

            1 Reply Last reply Reply Quote 0
            • N
              nassman
              last edited by

              Good work.
              But i note the most rules on the firewall in lan tab not work such as DMZ, protocols dont like load balance…etc.
              So i added the rules in  Floating tab, and work.
              Please give us more details to get more quality.
              thanks

              1 Reply Last reply Reply Quote 0
              • N
                nassman
                last edited by

                Also appeare problem in Dynamic DNS,

                Jul 21 20:01:53 php: : Curl error occurred: couldn't connect to host
                Jul 21 20:01:53 php: : DynDns: Current Service: opendns
                Jul 21 20:01:53 php: : DynDns: DynDns _checkStatus() starting.
                Jul 21 20:00:38 php: : DynDns: DynDns _update() starting.
                Jul 21 20:00:38 php: : DynDns debug information: DynDns: cacheIP != wan_ip. Updating. Cached IP: 188.161.249.229 WAN IP: 188.161.249.123
                Jul 21 20:00:38 php: : DynDns: Current WAN IP: 188.161.249.123 Cached IP: 188.161.249.229
                Jul 21 20:00:38 php: : DynDns debug information: 188.161.249.123 extracted from checkip.dyndns.org
                Jul 21 20:00:37 php: : DynDns: updatedns() starting

                thanks

                1 Reply Last reply Reply Quote 0
                • H
                  heper
                  last edited by

                  nassman for dyndns you need to override the floating rule that balances the http traffic ….

                  so basically you need to create a rule with destination=your_dyndns_provider to use the correct gateway

                  1 Reply Last reply Reply Quote 0
                  • N
                    nassman
                    last edited by

                    heper thank you, but can u give me a pic for example.

                    also after i installed squid, when open Dashboard, in system information some times appear this
                    Version 2.0-RC3 (i386)
                    built on Tue Jul 19 02:18:00 EDT 2011

                    Unable to check for updates.

                    and some times  work.

                    what the solution?
                    thanks

                    1 Reply Last reply Reply Quote 0
                    • S
                      stramato
                      last edited by

                      @nassman:

                      heper thank you, but can u give me a pic for example.

                      also after i installed squid, when open Dashboard, in system information some times appear this
                      Version 2.0-RC3 (i386)
                      built on Tue Jul 19 02:18:00 EDT 2011

                      Unable to check for updates.

                      and some times  work.

                      what the solution?

                      Yes, it will not be able to check updates. My quick and dirty fix for this is to temporarily disable the floating rule when I want to check for updates.
                      thanks

                      1 Reply Last reply Reply Quote 0
                      • N
                        nassman
                        last edited by

                        stramato,
                        i added floating rule and make pfsense website same as DMZ, not load balance, it work and check for update.
                        thanks.

                        1 Reply Last reply Reply Quote 0
                        • I
                          ihuntian
                          last edited by

                          can you elaborate more?

                          on how the rule will look like? thanks!

                          1 Reply Last reply Reply Quote 0
                          • C
                            chanrio13
                            last edited by

                            does this mean that i dont need to create a rule on lan tab?  can you show any screenies of your lan tab rule?

                            1 Reply Last reply Reply Quote 0
                            • D
                              Daouid
                              last edited by

                              Yeah !
                              Thanks, it works !!

                              1 Reply Last reply Reply Quote 0
                              • ?
                                Guest
                                last edited by

                                Thak you for this how-to! It works wonderful with squid.
                                But it's not apply to HAVP.
                                We have SQUID with SQUIDguard as transparent and HAVP as it's parent.
                                If we set firewall rules as you show, pages load by half, styles and images miss or even some site become unaccessible (timeout).
                                How can we make HAVP to load balance?

                                1 Reply Last reply Reply Quote 0
                                • P
                                  pubmsu
                                  last edited by

                                  Hello,

                                  The following aspects are not clear:

                                  1. You're selecting only WAN1 in the "interface packets must arrive to match rule" in the floating rule. Now the questions are

                                  (a) are you assuming that squid will always through packets on WAN1 only?

                                  (b) does which WAN should be selected in the interfaces box depend on the default gateway setting of the pf box?

                                  © if no default gateway is selected in the pf general settings, then which interface(s) will squid output packets to? Is that random? Like in the case of 3 WANs, squid may output packets to any of the 3 WANs?

                                  (d) if any of the 3 WANs may be used by squid, in that case do we have to multi-select all WANs in that interfaces box?

                                  2. For loadbalancing in particular, @heper's instructions included an additional "matching rule" where he was marking packets and later on in another rule routing those marked packets - to achieve loadbalancing. But in your steps that rule is not there. So is it the case that loadbalancing may be achieved without going for such packet-marking-routing as done previously by @heper?

                                  Dear @heper, you can also clarify please...

                                  1 Reply Last reply Reply Quote 0
                                  • P
                                    pubmsu
                                    last edited by

                                    And there's still another HOW TO by @DimitriS, which also differs with the steps in this thread:

                                    http://forum.pfsense.org/index.php/topic,37083.0.html

                                    @heper's HOW TO is here:

                                    http://forum.pfsense.org/index.php/topic,33895.msg176448.html#msg176448

                                    1 Reply Last reply Reply Quote 0
                                    • H
                                      heper
                                      last edited by

                                      1a: squid will Allways TRY to go out the default gateway … assuming that is WAN1 , you only need floating rule on that one
                                      1b: see 1a
                                      1c: not sure but i guess the default "WAN" interface, try if you wanna be sure
                                      1d: see 1a

                                      2. the matching rule is useless, it appeared packets were getting looped twice around the packet filter but
                                      emal pointed out the following:

                                      It hits it twice but really it does not execute the policy routing the second time.
                                      Only the nat rules are executed.

                                      1 Reply Last reply Reply Quote 0
                                      • P
                                        pubmsu
                                        last edited by

                                        Thanks for your answers, @heper - really appreciate this.

                                        We're in the process of extensively testing our triple-WAN, load-balancing with transparent squid and will report back if there's any case where it doesn't function as expected.

                                        1 Reply Last reply Reply Quote 0
                                        • M
                                          MrsPotter
                                          last edited by

                                          @heper will any of the above change when the squid is not transparent?

                                          1 Reply Last reply Reply Quote 0
                                          • F
                                            frater
                                            last edited by

                                            I read this thread and was able to get loadbalancing squid working using the post of the OP.
                                            But in my multi-LAN multi-WAN environment I don't want to run squid as a transparent proxy on ALL interfaces.

                                            I'm now afraid some packets that are going out to port 80 and not coming from squid are loadbalanced as well…
                                            I don't want this as I have issues with round-robin on certain websites.....

                                            I took a look at the approach heper did and am now doing the following....

                                            mark all TCP packets going to port 80 coming from 127.0.0.0/8
                                            on the interface of the default gateway send the marked packages to loadbalance.
                                            I have not switched to AON (manual NAT) nor did I select localhost as one of the proxy's interface...

                                            Could someone please comment?

                                            BTW...  it's still not actually working here...

                                            EDIT:

                                            I did some more testing....
                                            If I route all TCP out packets to port 80 to the round-robin interface, it is working... But because I'm logging it I also know that packets not coming from squid are using round-robin as well.
                                            I don't want this....

                                            If I also check the marking of the packets, it doesn't detect any of them and nothing goes through the round-robin interface.
                                            It seems that marking of the packets coming from 127.0.0.1 doesn't work....

                                            In combination with the absence of the lo0 interface in the pfsense webif it makes me think there's no firewall between the local interface and the rest....

                                            HELP?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.