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

    Carp. OpenVPN client - permanent connection and disconnection

    Scheduled Pinned Locked Moved HA/CARP/VIPs
    18 Posts 2 Posters 1.5k 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.
    • A
      alexanko
      last edited by alexanko

      Set up carp. When you restart any of the pfsense1 or pfsense2 servers, the Internet works, the OpenVPN Server clients are active (on Master server), everything works, except for the OpenVPN client, clients - connect and restart.

      OpenVPN Server works correctly:
      pfsense1 (master): service OpenVPN Server - ON
      pfsense2 (backup): service OpenVPN Server - OFF

      OpenVPN Client - clients connect and restart every 5 sec.:
      pfsense1 (master): service OpenVPN clients- ON
      pfsense2 (backup): service OpenVPN clients - ON

      Tell me in which direction to move in order to solve this problem.

      1 Reply Last reply Reply Quote 0
      • DerelictD
        Derelict LAYER 8 Netgate
        last edited by

        They will always disconnect and connect again because there is no OpenVPN client connection state between HA nodes in the cluster.

        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
        • A
          alexanko
          last edited by

          @Derelict said in Carp. OpenVPN client - permanent connection and disconnection:

          They will always disconnect and connect again because there is no OpenVPN client connection state between HA nodes in the cluster.

          Does this problem have a solution?

          1 Reply Last reply Reply Quote 0
          • DerelictD
            Derelict LAYER 8 Netgate
            last edited by

            Only solution to completely seamless failover is to use a firewall that shares OpenVPN connections and states between the HA nodes. I don't know of one. I know pfSense does not.

            There might be some techniques to make failover faster, but that depends on exactly how you have it set up, what kind of OpenVPN connections you're talking about, etc.

            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)

            A 1 Reply Last reply Reply Quote 0
            • A
              alexanko @Derelict
              last edited by

              @Derelict said in Carp. OpenVPN client - permanent connection and disconnection:

              Only solution to completely seamless failover is to use a firewall that shares OpenVPN connections and states between the HA nodes. I don't know of one. I know pfSense does not.
              There might be some techniques to make failover faster, but that depends on exactly how you have it set up, what kind of OpenVPN connections you're talking about, etc.

              6bb80b3b-44c8-4f8a-b490-3a0eed74fcc1-image.png

              A 1 Reply Last reply Reply Quote 0
              • A
                alexanko @alexanko
                last edited by

                @alexanko
                "...There might be some techniques to make failover faster, but that depends on exactly how you have it set up, what kind of OpenVPN connections you're talking about, etc...." - what methods can automate the switching of openVPN client between master and backup

                1 Reply Last reply Reply Quote 0
                • DerelictD
                  Derelict LAYER 8 Netgate
                  last edited by

                  I have no idea what you are trying to communicate there. Sorry.

                  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
                  • A
                    alexanko
                    last edited by

                    Thank you very much

                    DerelictD 1 Reply Last reply Reply Quote 0
                    • DerelictD
                      Derelict LAYER 8 Netgate @alexanko
                      last edited by

                      @alexanko

                      How to do auto switch?

                      Bind the OpenVPN server to the CARP VIP.

                      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)

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        alexanko @Derelict
                        last edited by

                        @Derelict

                        I have configured carp, and everything works fine when switching (master / backup status) between servers, except for one service - "openVPN CLIENT".
                        Servise - "openVPN SERVER" - works correctly when rebooting (crashing) servers: "ON status - on master pfsense server and OFF - on backup pfsense server"

                        1 Reply Last reply Reply Quote 0
                        • DerelictD
                          Derelict LAYER 8 Netgate
                          last edited by Derelict

                          You need to tell the OpenVPN server to listen on a CARP VIP, not the interface address.

                          When you do that the server will only run on the node currently holding CARP MASTER.

                          Same thing with the client. Set the interface to the CARP VIP.

                          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)

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            alexanko @Derelict
                            last edited by

                            @Derelict said in Carp. OpenVPN client - permanent connection and disconnection:

                            You need to tell the OpenVPN server to listen on a CARP VIP, not the interface address.
                            When you do that the server will only run on the node currently holding CARP MASTER.
                            Same thing with the client. Set the interface to the CARP VIP.

                            "You need to tell the OpenVPN server to listen on a CARP VIP, not the interface address." - It was done. Сonfigured initially
                            "When you do that the server will only run on the node currently holding CARP MASTER." - Configured initially. The openvpn SERVER is working correctly.
                            "Same thing with the client. Set the interface to the CARP VIP." - Installed .. service does not work correctly

                            A 1 Reply Last reply Reply Quote 0
                            • A
                              alexanko @alexanko
                              last edited by

                              @Derelict
                              When I bind OVPN Client to CARP VIP interface I see two concurent connections on remote OVPN server from real IPs of my master and backup PFSense

                              A 1 Reply Last reply Reply Quote 0
                              • A
                                alexanko @alexanko
                                last edited by

                                @alexanko
                                e05ac2ad-25da-4b4b-afd1-545762dceead-image.png

                                1 Reply Last reply Reply Quote 0
                                • DerelictD
                                  Derelict LAYER 8 Netgate
                                  last edited by

                                  Did you properly set the CARP VIPs on that gateway group?

                                  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)

                                  A 1 Reply Last reply Reply Quote 0
                                  • A
                                    alexanko @Derelict
                                    last edited by alexanko

                                    @Derelict said in Carp. OpenVPN client - permanent connection and disconnection:

                                    Did you properly set the CARP VIPs on that gateway group?

                                    The problem has been resolved.
                                    First, in the settings, OpenVPN / clients / interface installed a group of gateways (consisting of 3 WANs).
                                    When I replaced the WAN gateway group with one of the VIP WANs - carp.failover - service-VPNclient switched correctly ...
                                    thank

                                    1 Reply Last reply Reply Quote 0
                                    • DerelictD
                                      Derelict LAYER 8 Netgate
                                      last edited by

                                      You can use a gateway group but you have to set up the gateway group using CARP VIPs.

                                      Screen Shot 2019-08-19 at 12.50.50 AM.png

                                      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)

                                      A 1 Reply Last reply Reply Quote 0
                                      • A
                                        alexanko @Derelict
                                        last edited by

                                        @Derelict
                                        Super. Fine. Exactly what is needed !

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