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

    IPSec and NAT

    Scheduled Pinned Locked Moved IPsec
    2 Posts 2 Posters 1.1k 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.
    • rcfaR
      rcfa
      last edited by

      I understand that IPSec (unfortunately) snatches packets the moment they enter the system (thus making policy-based routing involving IPSec virtually impossible), what I don’t get is why that still happens when the particular IPSec tunnel is down.

      It seems I cannot use Outbound NAT as a failover when the IPSec connection doesn’t go up, unless I actually disable the tunnel entirely, it not being up isn’t sufficient for traffic to go out the NAT route instead. I guess this prevents traffic going out unencrypted unintentionally, but it prevents a fail-over in my use scenario.

      What I have is a LAN where each device has a public IP. That IP range is routed (for lack of ISP cooperation) via IPSec to a colo where I have a second pfSense box, to which that address range is routed.

      For regular web browsing, etc. and when the IPSec link is down for whatever reason, it would be useful if locally initiated outgoing traffic could simply use NAT and the local ISP’s DHCP assigned address to provide basic fast access for information that’s just consumed.
      On the other hand for remote initiated access (e.g. VNC, ssh to my systems), and for services (DNS, SMTP, HTTP) on the public IPs, traffic should go in and out of the IPSec tunnel without NAT.

      Is there a way to achieve that sort of policy routing given the odd routing restrictions I have (public IP traffic needing to pass through some sort of pfSense supported tunnel)

      1 Reply Last reply Reply Quote 0
      • C
        cmb
        last edited by

        That's the nature of how it works. Traffic matching the SPD is intercepted and sent across the IPsec if there is a matching SA. If the IPsec can't come up, it gets dropped.

        IPsec transport mode with a gif or GRE tunnel and a dynamic routing protocol is how failover is accomplished. Or policy routing though that's usually more complicated since you have to make sure routing on both ends is updated appropriately.

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