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

Packets are not NAT'ted and encrypted when sent over IPSec2 interface

NAT
2
9
154
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.
  • B
    Blade1024
    last edited by 17 days ago

    Hi Guys,

    We have a private, non-internet-connected setup where inbound packets from the WAN interface (we have a host on the WAN subnet from which I am testing) must be sent into the IPSec tunnel and NAT'd. The IPSec connection is established over the same WAN interface, and routes are populated through a BGP session that runs within this IPSec. We have a few other hosts that are connected to the gateway beyond the WAN interface, which should use this path. The test WAN host is probing the path for them. Now, what I see is:

    1. NAT is being performed, and ESPs are not being sent out via the WAN interface matching the outgoing traffic if the NAT rule has the named IPSec interface that carries the BGP session (BGP sessions and pings to the other side of the tunnel are working fine). If I disable the NAT rule for this traffic, the ESPs are being sent out.
    2. NAT is not being done, but ESPs are being sent out if I have IPSec (plain) specified in the NAT.

    The desired scenario is when the WAN-originated traffic is being NAT'd. Does anyone have any idea why? The software version is a tad new - 25.03-BETA. The earlier one was crashing while attempting to push the NAT'd traffic via IPSec.

    Responses appreciated,
    Cheers

    1 Reply Last reply Reply Quote 0
    • B Blade1024 referenced this topic 17 days ago
    • B Blade1024 referenced this topic 17 days ago
    • S
      stephenw10 Netgate Administrator
      last edited by stephenw10 16 days ago 16 days ago

      What sort of IPSec tunnel is this? How are you routing traffic from the WAN subnet via the tunnel?

      If it's policy based you must NAT the traffic in P2 or it won't match.

      B 1 Reply Last reply 16 days ago Reply Quote 0
      • B
        Blade1024 @stephenw10
        last edited by Blade1024 16 days ago 16 days ago

        @stephenw10

        Hi, Yes, like this:

        Host->WAN->NAT->IPsec

        Just installed commercial authentic paid AWS image 24.11 and it crashed on the first NAT packet. Same issue as in the community. All it takes is one NAT invocation.

        It is not a policy - it is an OPT interface with the BGP routing on top of it.

        Regards

        B 1 Reply Last reply 16 days ago Reply Quote 0
        • B
          Blade1024 @Blade1024
          last edited by 16 days ago

          @stephenw10

          Went into the latest 25.03BETA - still the same. ESP's are not generated for the NAT'ted traffic.

          Regards

          1 Reply Last reply Reply Quote 0
          • S
            stephenw10 Netgate Administrator
            last edited by 16 days ago

            Yup that bug you were hitting is fixed in 25.03.

            So the IPSec is setup as route mode (VTI)?

            And traffic coming into the WAN is simply routed across it by the system routing which is populated by BGP?

            Where do you have the NAT applied? Inbound on WAN or Outbound on VTI?

            What do you have IPsec Filter Mode set to in the advanced IPSec settings? You would need that set as filter on VTI if you're outbound NATing there.

            B 1 Reply Last reply 16 days ago Reply Quote 0
            • B
              Blade1024 @stephenw10
              last edited by 16 days ago

              @stephenw10

              Thank you for the bug clarification!
              Yes, IPSec is in VTI mode creating the OPT1 interface and BGP is running over it. NAT is outbound for a specific subset of traffic going out via OPT1. Let me try the filter mode. I will come back in a sec.

              B 1 Reply Last reply 16 days ago Reply Quote 0
              • B
                Blade1024 @Blade1024
                last edited by 16 days ago

                @stephenw10

                You are the hero, man! It works!!!! Thank a ton - you saved my lower back ;-)

                That was a close call. Cheers and let me know where should I send beers to.

                P.S.: Did you figure out the interfaces? I have the same behavior for commercial 24.11 release - the interface assignments do not survive the reboot.

                1 Reply Last reply Reply Quote 1
                • S
                  stephenw10 Netgate Administrator
                  last edited by 16 days ago

                  Nope, I haven't found the interfaces issue yet. Let's dig into that further in the other thread.

                  B 1 Reply Last reply 16 days ago Reply Quote 0
                  • B
                    Blade1024 @stephenw10
                    last edited by 16 days ago

                    @stephenw10

                    Let me know if you need any info.

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