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

    How to distribute connections between two wan-ip interfaces

    Scheduled Pinned Locked Moved OpenVPN
    32 Posts 4 Posters 2.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.
    • dotdashD
      dotdash @wesleylc1
      last edited by

      @wesleylc1
      If you are running a single openvpn server, I think you would need to check the state table to see which connection clients came in on.

      W 1 Reply Last reply Reply Quote 0
      • W
        wesleylc1 Rebel Alliance @dotdash
        last edited by

        @dotdash
        According to the image, this client connected to WAN2-IP, after including "remote-random" in config.OVPN.
        But is it possible to validate clients by accessing the two WAN interfaces in a balanced way?

        Captura de tela de 2020-04-01 19-12-01.png

        W 1 Reply Last reply Reply Quote 0
        • W
          wesleylc1 Rebel Alliance @wesleylc1
          last edited by

          @wesleylc1 said in How to distribute connections between two wan-ip interfaces:

          @dotdash
          According to the image, this client connected to WAN2-IP, after including "remote-random" in config.OVPN.
          But is it possible to validate clients by accessing the two WAN interfaces in a balanced way?

          Captura de tela de 2020-04-01 19-12-01.png

          According to this other image, it is possible to identify that the same client made a connection using WAN1-ip, aleratorically, but during this connection there were few clients connected, compared to the moment of the first image.

          Captura de tela de 2020-04-01 21-52-51.png

          1 Reply Last reply Reply Quote 0
          • dotdashD
            dotdash
            last edited by

            The remote-random option only randomizes the server order on the client side. It is never going to work in any sort of balanced or intelligent way. You could look at a front end load balancer, but that is beyond the scope of this topic, or this forum.

            W 1 Reply Last reply Reply Quote 0
            • W
              wesleylc1 Rebel Alliance @dotdash
              last edited by

              @dotdash
              I understand that, at this point, it may be a random solution, but I want a solution that works intelligently as a load balancer between the two WAN interfaces. Do you think a new topic should be opened for that matter?

              1 Reply Last reply Reply Quote 0
              • W
                wesleylc1 Rebel Alliance @Rico
                last edited by

                @Rico said in How to distribute connections between two wan-ip interfaces:

                Hmm I never tried with (Open)VPN and maybe it's kind of shoddy....you could also round robin your DNS (target IPs).

                Dear @rico, I didn't understand your interaction, can you try to explain to me what can be bad about using DNS to the destination IPs?

                1 Reply Last reply Reply Quote 0
                • dotdashD
                  dotdash
                  last edited by

                  Round robin DNS is simply adding both IPs to the DNS record. It is no more sophisticated than using the remote-random option. If you want something more intelligent, I would suggest an actual load balancer. I believe Kemp still has a free version available. I'd look into something like that, because it seems you will not be happy with the fairly crude methods available directly in OpenVPN.

                  W 1 Reply Last reply Reply Quote 0
                  • W
                    wesleylc1 Rebel Alliance @dotdash
                    last edited by

                    @dotdash
                    Do you believe that load balancing is possible with HAProxy?

                    1 Reply Last reply Reply Quote 0
                    • dotdashD
                      dotdash
                      last edited by

                      HAProxy doesn't work with UDP. You could possibly switch to TCP (and reduce performance for you clients) and hack something together. I don't know. You could ask in the packages section, but ultimately I do not think it will be satisfactory. In my opinion, you can just go the easy and ugly way with remote-random, or get an actual load balancer and do it right.

                      W 1 Reply Last reply Reply Quote 0
                      • W
                        wesleylc1 Rebel Alliance @dotdash
                        last edited by

                        @dotdash According to your answer, using HAProxy would not be the best option for my scenario, as stated, I would have to use TCP on HAProxy and submit myself to reduce the performance of my clients, and that is not what I want to apply.

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