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

    How to make loadbalancing work from the pfSense box itself?

    Scheduled Pinned Locked Moved Routing and Multi WAN
    8 Posts 4 Posters 1.9k 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.
    • D
      dims
      last edited by

      I found, that load balancing does not work if ran from pfSense box itself.

      For example, if I query

      curl somesite.com

      then the site sees that requests are coming from default gateway only.

      Simultaneously, if I do the same command from any computer in the LAN, the requests are coming from different gateways, i.e. load balancing is working.

      How to do so that load balancing work from pfSense too? And if it is impossible, then what is the reason for that?

      1 Reply Last reply Reply Quote 0
      • K
        kapara
        last edited by

        Why is that an issue for you?

        Skype ID:  Marinhd

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          It isn't possible currently.

          For traffic flowing through the firewall, pf can make the decision to re-route the packet to another gateway easily.

          For traffic from the firewall itself, the OS selects the interface/bind address/etc according to the system routing table, and it's too late for pf to alter that.

          In the past there were some hacks done to pf to allow that to work, but they were dropped a long time ago since it was not viable on newer versions of pf.

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • luckman212L
            luckman212 LAYER 8
            last edited by

            For 99% of situations, this isn't a big problem really. But one specific case that I've been struggling with for many moons is how to guarantee that email alerts will get delivered in a multi-wan scenario.  (See my most recent post about this)

            Chris, do you have any ideas for a solution to that? Is there a way to reference the "current/working gateway of a gateway group" in a PHP variable? If so, then my recent hack of replacing fsockopen() with stream_socket_client() in /etc/inc/smtp.inc could work (it worked in my testing when I manually specified the IP of a working gateway…) without changing the firewall's default route.

            1 Reply Last reply Reply Quote 0
            • K
              kapara
              last edited by

              Route  traffic to internal server which uses gateway group to send smtp

              Skype ID:  Marinhd

              1 Reply Last reply Reply Quote 0
              • luckman212L
                luckman212 LAYER 8
                last edited by

                Not as common to have an "internal mail server" these days. Most of the locations where I have pfSense installed (including my home) do not have one.

                1 Reply Last reply Reply Quote 0
                • jimpJ
                  jimp Rebel Alliance Developer Netgate
                  last edited by

                  Activate Default Gateway Switching, and then so long as you don't have a static route pushing the mail server out a specific gateway, it should work.

                  Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                  Need help fast? Netgate Global Support!

                  Do not Chat/PM for help!

                  1 Reply Last reply Reply Quote 0
                  • K
                    kapara
                    last edited by

                    Hmm.  I wonder if gateway switching would resolve my issue of not getting syslog notifications when my primary wan goes down at one client.

                    Skype ID:  Marinhd

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