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

    [Solved] Port Forwarding over IPsec Issue

    Scheduled Pinned Locked Moved NAT
    4 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.
    • M
      MeCJay12
      last edited by MeCJay12

      Hello! I am having trouble port forwarding from one of my pfSense routers over an IPsec S2S to another pfSense router. All of my IPsecs are vtis with OSPF running on top and all of my hosts are able to communicate with other hosts correctly. The only issue is that when I port forward from the remote router across the IPsecs, I have to set the default gateway on the local router to the IPsec vti. If I don't do this, pfSense routes my return traffic out the local Internet connection instead of back over the tunnel. This is a problem because when the routers boots, it's not always able to re-establish my tunnels since it is trying to use those tunnels as a default route. Any workarounds for this yet? I used to use OpenVPN for my S2Ss and it used to have the same issue.

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

        That's expected with IPsec, even with VTI. There is no way for the receiving pfSense to know that traffic must return over IPsec. The pf reply-to function doesn't work on VTI interfaces, so the traffic follows the default route.

        The only solutions are to use OpenVPN (assigned OpenVPN interfaces can use reply-to which will return traffic via expected paths) or to proxy the traffic where it enters from the Internet, rather than port forwarding. In that case the request over IPsec appears to come from the firewall and not a remote client.

        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
        • M
          MeCJay12
          last edited by

          Didn't even think of that. HAProxy configured and working.

          I do have another question though: I have a LAN policy route for everything from the port forwarded host to go back to the remote router. Why do I even need the reply-to?

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

            A policy routing rule on the LAN only works for connections created by that rule -- new connections leaving the LAN and exiting the firewall (in this case, via IPsec).

            The connection that didn't work are in the opposite direction -- Permitted by the rule on the IPsec interface, NOT the rule on LAN. And putting a gateway on that rule would not be valid.

            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
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.