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

    NAT Reflection Auto Outbound NAT

    Scheduled Pinned Locked Moved NAT
    6 Posts 2 Posters 829 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.
    • planedropP
      planedrop
      last edited by

      Hoping I can get some clarification about exactly what is going on with this hairpin NAT setup I have going, everything is working as expected but I feel like it shouldn't.....

      So in short I have a web server that is on another VLAN, due to reasons I can't use split DNS, so I made sure NAT Reflection is setup with Pure NAT, then added a rule on the main LAN address to allow connections to that web server on the VLAN.

      Everything works, but here is where I'm confused, I do NOT have "Enable automatic outbound NAT for Reflection" checked, so shouldn't this rule not work? As in, shouldn't the web server be trying to reply back from it's local IP which would break this entire connection?

      In another similar setup with pfSense I have basically the same configuration but I have this checked, and that works fine too, seemingly no difference.

      planedropP 1 Reply Last reply Reply Quote 0
      • planedropP
        planedrop @planedrop
        last edited by

        @planedrop Wait, maybe I have this figured out, is this quite literally just because they are on different VLANs?

        Basically, the server has no knowledge of the other VLAN so it just sends it back out the default gateway and then the NAT rules happen as they should, BUT if things were on the same VLAN the server would attempt responding back to that local IP instead of through the firewall, which would break the connection.

        So then this option also NATs the source address to that of the firewalls address on that VLAN so the reply from server routes back through and can be NATed again?

        S 1 Reply Last reply Reply Quote 0
        • S
          SteveITS Galactic Empire @planedrop
          last edited by

          @planedrop I’m actually not sure where that setting is without looking. :) Outbound NAT is typically choosing the public IP used towards the Internet.

          The port reflection will cause the router to forward towards the server. The server will reply to its gateway because the source IP isn’t in its subnet. The router forwards the reply packet to the LAN IP because it knows where that subnet is. Outbound NAT shouldn’t be involved here.

          Why not split DNS? pfSense has a host override in DNS so you could specify the VLAN IP of the server there.

          Pre-2.7.2/23.09: 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 restart, or more depending on packages and device speed.
          Upvote 👍 helpful posts!

          planedropP 1 Reply Last reply Reply Quote 1
          • planedropP
            planedrop @SteveITS
            last edited by

            @SteveITS This is the setting within the Advanced > Firewall & NAT settings, but I think I have a proper understanding of it now, with or without this setting enabled, services on another subnet will still work just fine, but if the server/service is on the SAME subnet as a device, then you have to have this checked or the server will just ARP and respond directly to the client.

            As for split DNS it's a long story, the AD environment this is running in makes splitDNS not an option.

            S 1 Reply Last reply Reply Quote 0
            • S
              SteveITS Galactic Empire @planedrop
              last edited by

              @planedrop If the device and server (both IPs) are on the same network packets do not go through the router.

              Re AD, Windows DNS can forward to pfSense, or pfSense can have a domain override for the AD zone.

              Pre-2.7.2/23.09: 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 restart, or more depending on packages and device speed.
              Upvote 👍 helpful posts!

              planedropP 1 Reply Last reply Reply Quote 0
              • planedropP
                planedrop @SteveITS
                last edited by

                @SteveITS Correct, but this is in relation to NAT reflection, so the IP is being accessed externally.

                I just didn't understand this setting until now. All it's doing is NATing the source IP to the routers IP on that interface, this way if the client tries to connect to the web server's public IP, but the web server is on the same subnet as the client, the web server itself sees the connection coming from the routers default gateway IP, this way it responds back to the router instead of trying to direct connect to the client (since they're on the same layer 2), so that the NAT reflection can NAT things back like it should.

                I was trying to figure out why NOT having this setting enabled under Advanced > Firewall & NAT was still working, but that was simply because the NATing of the source was not necessary since the web server is on it's own subnet, so the web server is going to reply to the default gateway on it's subnet regardless.

                As for split DNS that is exactly what I would normally do, but this is a bit more complex of an environment, but NAT reflection works perfectly in the meantime, I was just trying to be sure I fully understood the settings I was looking at.

                All makes sense now though! Appreciate the replies here.

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