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

    Load Balance and Squid does not work runnig in the same server

    Scheduled Pinned Locked Moved 2.0-RC Snapshot Feedback and Problems - RETIRED
    53 Posts 17 Posters 45.3k 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.
    • E
      eri--
      last edited by

      Just loadbalance even DNS as well as you do for TCP traffic.

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

        Thank you Heper!

        I just put a patch that will include localhost(127.0.0/8) on the default nat rules so AON will not be needed anymore in the configuration.
        Should be easier now by just creating a floating rule and selecting the gateway group on it.

        Ermal, may you please expound on this. What is the difference between this and heper's screenshots? Thanks!

        1 Reply Last reply Reply Quote 0
        • E
          eri--
          last edited by

          You have to put an additional rule the same as in the previous screenshot but the protocol should be UDP and outgoing port 53.
          That will help with dns.

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

            i will try to config it, now i dont need to add AON rule, or need
            regards

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

              Still not work.
              what is the wrong????!!!!!

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

                ermal,
                  I have configured the rule you said, balancing the DNS requests too. but it doesn't work. My DNS is in the DMZ so the connections to it can't be balanced because it don't pass trough the gateways to access. with that rule, who are out of the proxy have DNS problems too. so if I put a rule without balancing to the DMZ subnet in the floating rules before the balance rule, the normal connections work but the proxy connections still without name resolution.

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

                  i'd suggest you try setting up a virtual machine with a basic dns server on your lan subnet (be it on windows or linux or bsd).
                  If that solves your problems then you can be certain it's a dns issue

                  if you don't want to waste time setting up VM's then i suggest you add some rules to log all udp traffic on port 53
                  also packet captures can help figuring out where or what gets stuck

                  One of the things i've noticed is when you pull WAN1 interface offline, the frontpage of the pfsense gui will start to go really slow (ie. waiting for a time-out).
                  to work around this issue close the "system information" widget …. this checks for updates and fails because it doesn't find dns

                  @digossantos:

                  ermal,
                    I have configured the rule you said, balancing the DNS requests too. but it doesn't work. My DNS is in the DMZ so the connections to it can't be balanced because it don't pass trough the gateways to access. with that rule, who are out of the proxy have DNS problems too. so if I put a rule without balancing to the DMZ subnet in the floating rules before the balance rule, the normal connections work but the proxy connections still without name resolution.

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

                    didn't work for me as well..

                    1 Reply Last reply Reply Quote 0
                    • 3
                      3dinfluence
                      last edited by

                      @ermal:

                      I just put a patch that will include localhost(127.0.0/8) on the default nat rules so AON will not be needed anymore in the configuration.
                      Should be easier now by just creating a floating rule and selecting the gateway group on it.

                      Is this patch now in the public RC1 builds?  I have the build from Tue Mar 15 08:53:58 EDT 2011 and when I go into the NAT rules and AON I'm not seeing any default rules for 127.0.0/8.

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

                        Is there anyone trying to do this with multiple vlans also? I had it working per the various posts in this thread, but it broke my ability to get to http sites on other vlans. I think having squid using 127.0.0.1 is what breaks it.

                        1 Reply Last reply Reply Quote 0
                        • O
                          onkeldave83
                          last edited by

                          and when i use although havp with parent to squid????????

                          in this case :

                          tcp_outgoing_address 127.0.0.1;never_direct allow all;cache_peer 127.0.0.1 parent 4444 0 name=havp no-query no-digest no-netdb-exchange default;redirect_program /usr/local/bin/squidGuard -c /usr/local/etc/squidGuard/squidGuard.conf;redirector_bypass on;redirect_children 3

                          ?????? what is with cache peer to loopback?

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

                            Still not work.
                            What is the solution?

                            1 Reply Last reply Reply Quote 0
                            • R
                              rubic
                              last edited by

                              Heper, thanks for your guide!
                              What advanced option used in the "matching rule, to stop balance twice" floating rule?
                              I used TCP flags: out of: SYN.
                              It works!

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

                                rubic:

                                it's possible to 'mark' packets when they hit one of your rules. Afterwards you can "search" for them packets using other rules, sort of ;)

                                so basically i use a floating rule to push all http traffic through de gateway-group; at the same time i 'mark' them.

                                i put another floating rule IN FRONT of my loadbalance-rule and added option 'quick' ; there i push packets out without going through gateway-group ; here i specify to 'match' the packets i 'marked' in my secondary rule.

                                see this

                                1 Reply Last reply Reply Quote 0
                                • R
                                  rubic
                                  last edited by

                                  Hm… will think about... however, looking at pf packet flow diagram, I wonder if floating load-balance rule can fire twice
                                  by the way, in my case your solution works even without binding squid to loopback ???

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    rubic
                                    last edited by

                                    heper, you were right!
                                    when default WAN is down, an outgoing packet hits the rule twice (both on WAN fnd OPT-WAN interface)
                                    if you don't mind I would like to translate your how-to for russian pfSense community
                                    thanks!

                                    1 Reply Last reply Reply Quote 0
                                    • E
                                      eri--
                                      last edited by

                                      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
                                      • R
                                        rubic
                                        last edited by

                                        @ermal:

                                        Only the nat rules are executed.

                                        There is one moment with NAT unclear to me. According to pf packet flow diagram (http://homepage.mac.com/quension/pf/flow.png) filtering happen after SNAT. That's why in the rule log we see: if:WAN src:WAN IP -> dst:remote host IP. But when packet rerouted by the policy routing rule reaches OPT-WAN outgoing chain (assuming WAN is down) it's source address appears magically restored to 127.0.0.1. Which block on the diagram do that?

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

                                          my "how-to" can be translated in any language … it's only purpose was to return the info i got from ermal to the community ;)

                                          1 Reply Last reply Reply Quote 0
                                          • E
                                            eri--
                                            last edited by

                                            rubic, its pfSense customized pf(4), by me. :)

                                            This functionality can not be done with standard pf(4), at least the version that is used on FreeBSD, without too much tinkering.

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