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

    Port Forwarding w/ OpenVPN Tunnel - What am I doing wrong?

    Scheduled Pinned Locked Moved NAT
    35 Posts 3 Posters 2.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.
    • V
      viragomann @techboot
      last edited by

      @techboot said in Port Forwarding w/ OpenVPN Tunnel - What am I doing wrong?:

      NAT:

      And the mess goes on...
      10.13.31.22 is your VPN interface address. The NAT IP has to be your internal server IP!

      Also you should limit the destination IP. Your may set it to the interface address.

      T 1 Reply Last reply Reply Quote 0
      • T
        techboot @viragomann
        last edited by

        @viragomann

        10.13.31.22 is my internal IP.

        The 10.65.130.4 is the IP assigned by the VPN provider.

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

          @techboot
          Ah ya. So you need to edit the outbound NAT rule and correct the destination IP.

          T 1 Reply Last reply Reply Quote 0
          • T
            techboot @viragomann
            last edited by

            @viragomann

            Cleared States.

            7cf805f8-d2b9-433b-870d-eb8def925db5-image.png

            --
            8fb7dacc-2a54-4eaa-918e-b266c891c0d1-image.png

            --

            I am confused what you mean by limit the destination IP and limit to the interface address. I assume you mean on the port forward tab?

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

              @techboot said in Port Forwarding w/ OpenVPN Tunnel - What am I doing wrong?:

              I assume you mean on the port forward tab?

              Yes.

              In the LAN outbound NAT rule correct the translation to interface address, please, which is the default setting.

              T 1 Reply Last reply Reply Quote 0
              • T
                techboot @viragomann
                last edited by

                @viragomann

                I think I have now gone and confused myself in all of this. Thank you for bearing with me.

                Like this?

                67d33750-6821-460f-94d2-656873739ca8-image.png

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

                  @techboot
                  destination: internal server IP with /32 mask
                  translation: LAN address

                  T 2 Replies Last reply Reply Quote 0
                  • T
                    techboot @viragomann
                    last edited by

                    @viragomann

                    37567752-4ef4-4600-9fcc-994185eabc28-image.png

                    Cleared States, No Change via Telnet or Port Tool.

                    1 Reply Last reply Reply Quote 0
                    • T
                      techboot @viragomann
                      last edited by techboot

                      @viragomann

                      Question on this...

                      4efeded8-a1ac-4009-8685-9b7633cdd0d9-image.png

                      These are my current OpenVPN Client (towards the VPN Provider) Settings... I was under the impression that I wanted the "Dont Pull Routes" checkbox selected, since that would otherwise set the default gateway for the whole router towards the VPN provider.

                      In my case, I want to only route specific IP's out via the VPN, which DOES currently work.

                      Could this actually be some of my port forward issues?

                      Edit: this is the documentation pertain to port forwarding from the VPN provider: https://airvpn.org/faq/port_forwarding/

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

                        @techboot said in Port Forwarding w/ OpenVPN Tunnel - What am I doing wrong?:

                        These are my current OpenVPN Client (towards the VPN Provider) Settings... I was under the impression that I wanted the "Dont Pull Routes" checkbox selected, since that would otherwise set the default gateway for the whole router towards the VPN provider.

                        That's correct. You don't need routes, since you do policy routing for outbound traffic.

                        Edit: this is the documentation pertain to port forwarding from the VPN provider: https://airvpn.org/faq/port_forwarding/

                        There is nothing mentioned, that the provider does masquerading as you stated above.
                        If he doesn't masquerading you need to enable reply-to for proper reply-routing.

                        For a quick test if this is the issue, remove the "Don't pull routes" check, ensure that the VPN is shown as default gateway in Status > Gateway, then test the access.

                        T 1 Reply Last reply Reply Quote 0
                        • T
                          techboot @viragomann
                          last edited by

                          @viragomann

                          Will try shortly.

                          To clarify, this is the only information that shows how they (provider's port check tool) works.

                          73a892e9-8216-45c4-885b-1dc8b9172e13-image.png

                          To me, that's public -> pfsense (as VPN client 10.65.138.204) -> LAN client (10.13.31.22)

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

                            @techboot
                            I don't expect, that the provider knows your LAN clients IP.

                            T 1 Reply Last reply Reply Quote 0
                            • T
                              techbooties @viragomann
                              last edited by

                              @viragomann

                              You make a fair point. I should have been more specific, but I added my LAN client IP for completeness. Apologies there.

                              However, with the test by disabling the don't pull routes .. success

                              529118b1-6189-4226-8cc5-0bc261bb924e-image.png

                              f1ae0b24-6900-4b9c-99ad-404061a3a20e-image.png

                              Understandably now my whole LAN is out the VPN, but how would I set reply-to for the proper routing as you mentioned?

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

                                @techbooties
                                You need to remove the pass rule from the OpenVPN tab.

                                If you are running an OpenVPN server come back with the info to elaborate, how you get access then.

                                T 1 Reply Last reply Reply Quote 0
                                • T
                                  techbooties @viragomann
                                  last edited by

                                  @viragomann

                                  I am using an OpenVPN server. I will try and specify my setup specifically for you.

                                  I have a single LAN. No VLAN's. I have a few machines in my homelab, one is (10.13.31.22).

                                  I have a primary internet connection, which should be used for all of my clients, EXCEPT those that are in the "VPNAccess" alias group. In this case, only 10.13.31.22 is listed.

                                  I have a VPN provider connection with a third party (airVPN) via the pfSense router, that I would like the members of VPNAccess alias group to use as their primary means of internet access. I would also like to use port forwarding with the VPN provider towards specific members of the VPNAccess alias (10.13.31.22 specifically).

                                  I have an OpenVPN Server, which I use for remote access to my home network. (ipad, raspberry pi remote backup, etc.) It is using only my primary internet connection. It's on the pfSense box directly, not via some other machine behind the router.

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

                                    @techbooties
                                    If it's an OpenVPN access server limit the source in the OpenVPN pass rule to its tunnel network.

                                    T 1 Reply Last reply Reply Quote 0
                                    • T
                                      techbooties @viragomann
                                      last edited by

                                      @viragomann

                                      wow. that worked!

                                      I changed the rule as you noted, 10.13.30.0/24 is my VPN net:

                                      1ba01ab7-bbc8-4adb-81fa-79aa742f4cc7-image.png

                                      I even killed the client, requested a new IP from another server and still works:
                                      1591218c-d603-4f61-808a-b3db5fa56279-image.png

                                      Can I ask why that made such a difference? Was it related to all being OpenVPN based connections?

                                      Thank you!!!

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

                                        @techbooties said in Port Forwarding w/ OpenVPN Tunnel - What am I doing wrong?:

                                        Can I ask why that made such a difference?

                                        In fact you have two WANs with inbound traffic. You real WAN and the VPN_WAN.
                                        In this case pfSense need to tag incoming connections with the reply-to, which includes the gateway assigned to the incoming interface. This is done by the filter rule, which allows the incoming packets.
                                        Without this, pfSense would send respond packets to the default gateway, regardless which interface the request did enter.

                                        However, that the reply-to is applied requires that the concerned rule is defined on the interface tab. It doesn't work on interface groups and floating rules.
                                        But the OpenVPN is an interface group in fact. It appears in pfSense, when you run either an OpenVPN server or a client and includes them all.
                                        AND both, interface group and floating rules have priority over interface rules by design. Hence there must not be any matching pass rule on theses tabs.

                                        The reply-to would not be necessary if the provider masquerades the traffic to the server IP, since this is within an assigned subnet.
                                        So it was misleading that you mentioned, the provider does masquerading.

                                        T 1 Reply Last reply Reply Quote 0
                                        • T
                                          techbooties @viragomann
                                          last edited by

                                          @viragomann

                                          Thank you again. I assume that this also would explain why I did see some kind of traffic with the port sniffing. Apologies for the confusion, my ignorance with assuming masquerading certainly didn't help. Lesson learned!

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