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

    OpenVPN on 2 pfsense instance with HA - service is running on both pfsense instances

    Scheduled Pinned Locked Moved OpenVPN
    15 Posts 5 Posters 1.9k Views 4 Watching
    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.
    • S Offline
      SteveITS Rebel Alliance @mav3rick
      last edited by

      @mav3rick But then if you're remote there's no way to connect in to start it. In pfSense the IPs move over but everything else is always running. Except DHCP I guess but that has the HA part built in.

      Hence the link above to deal with that via Outbound NAT rules.

      Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
      When upgrading, allow 10-15 minutes to reboot, or more depending on packages, and device or disk speed.
      Upvote 👍 helpful posts!

      mav3rickM 1 Reply Last reply Reply Quote 0
      • mav3rickM Offline
        mav3rick @SteveITS
        last edited by

        @SteveITS

        I see, i understand.

        I thought about NAT to fix this, but was wondering if vpn service running on both nodes was supposed to be like that or was some bug.

        I still think Netgate developers should consider running the vpn services on the master node only to avoid having to do NAT for this.

        V 1 Reply Last reply Reply Quote 0
        • V Offline
          viragomann @mav3rick
          last edited by

          @mav3rick
          If you bind the server to the CARP VIP or an IP alias hooking up on it, the service should not start on the node, since the IP is occupied by the master.

          However, if the VPN service is running on the backup or not, you should get access to it from a VPN client by adding an outbound NAT rule is described on the linked site above. Did you even add this rule?

          M mav3rickM 2 Replies Last reply Reply Quote 0
          • M Offline
            mcury Rebel Alliance @viragomann
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • M Offline
              mcury Rebel Alliance
              last edited by

              My 2 cents:
              I have a (HA) setup with OpenVPN running. I configured a port forward from the WAN VIP address to localhost on port 1194 (UDP), ensuring that connections only reach the master OpenVPN daemon.

              To access the secondary firewall, I set up an outbound NAT rule using the SYNC interface.
              From the secondary firewall's perspective, OpenVPN users will always appear to connect from the primary firewall's SYNC address

              1 Reply Last reply Reply Quote 0
              • mav3rickM Offline
                mav3rick @viragomann
                last edited by mav3rick

                @viragomann said in OpenVPN on 2 pfsense instance with HA - service is running on both pfsense instances:

                @mav3rick
                If you bind the server to the CARP VIP or an IP alias hooking up on it, the service should not start on the node, since the IP is occupied by the master.

                However, if the VPN service is running on the backup or not, you should get access to it from a VPN client by adding an outbound NAT rule is described on the linked site above. Did you even add this rule?

                Yes, now with the NAT rule it works, but i also had to add a rule to allow pfsense1 to ssh to pfsense2 and pfense2 ssh to pfsense1.

                I will also try without NAT and binding openvpn to CARP VIP to see if also works like that.

                V 1 Reply Last reply Reply Quote 0
                • V Offline
                  viragomann @mav3rick
                  last edited by

                  @mav3rick
                  As far as I know, the NAT rule is necessary anyway, because the backup has no proper route to the VPN client.

                  Binding the service to the CARP VIP should just prohibit it to start on the backup.

                  mav3rickM 1 Reply Last reply Reply Quote 0
                  • mav3rickM Offline
                    mav3rick @viragomann
                    last edited by mav3rick

                    @viragomann said in OpenVPN on 2 pfsense instance with HA - service is running on both pfsense instances:

                    @mav3rick
                    As far as I know, the NAT rule is necessary anyway, because the backup has no proper route to the VPN client.

                    Binding the service to the CARP VIP should just prohibit it to start on the backup.

                    In my case works because i have another router in front of pfsense that knows the route to pfsense opnvpn network, but if it wasn't the case i guess i could setup static routes for that.

                    So setting openvpn to bind only to the CARP VIP works fine for me, unfortunately for Wireguard there is no such option, so i guess for now i will have to go with the NAT option.

                    Anyway, thank you all for the help.

                    M 1 Reply Last reply Reply Quote 0
                    • M Offline
                      mcury Rebel Alliance @mav3rick
                      last edited by

                      @mav3rick said in OpenVPN on 2 pfsense instance with HA - service is running on both pfsense instances:

                      So setting openvpn to bind only to the CARP VIP works fine for me

                      Multi-WAN with HA there?
                      If so, it would be a better idea to run openVPN server on localhost instead.
                      This would allow it to receive connections from all WANs.

                      No need to select a VIP, just forward packets from the WANs VIPs to localhost.
                      You can use DNS, thus the client would connect to the WAN that is UP.
                      Or
                      You can use two remote entries in the .ovpn, with timeout lets say, 2 seconds.

                      Then, just create the NAT rule to access the firewall-2, using the SYNC address as previously mentioned.

                      N 1 Reply Last reply Reply Quote 0
                      • N Offline
                        netblues @mcury
                        last edited by netblues

                        If running a pf vpn server, in multiwan,. options above do work.

                        But if it is a client side s2s vpn, that need to be bound to a gateway group, then there are no options. If the wrong client connects last, iroute sends s2s traffic there, resulting into no connectivity.

                        Restarting vpn client on master pf, obviously, restores it, but I haven't found any way to automate this without disrupting traffic.
                        Is there an iroute cli option to do route manipulation without restarting?

                        Its an idea.

                        V 1 Reply Last reply Reply Quote 0
                        • V Offline
                          viragomann @netblues
                          last edited by

                          @netblues
                          You can force the clients traffic to a certain gateway (group) with a floating rule for direction 'out' on the wrong outbound interfaces.

                          N 1 Reply Last reply Reply Quote 0
                          • N Offline
                            netblues @viragomann
                            last edited by

                            @viragomann
                            Can you possibly elaborate on this?
                            A floating rule on the client pf? both instances? (active and stby?)

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