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

    Reaching an Internal Web Server using External DNS

    Scheduled Pinned Locked Moved Firewalling
    7 Posts 4 Posters 1.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.
    • S
      Stewart
      last edited by

      We have a client that has their own web server internally to their network.  It's for staff use but they also have a domain tied to it to make it easy for them to connect to.  On the old ASUS router everything worked fine.  With pfSense, if we go to their address www.address.com remotely it connects in as we have the appropriate ports forwarded.  If we go to www.address.com internally we get a DNS rebind attack page.  We disabled the DNS rebind setting but now nothing comes up when we go there (it's just a 404).  I'm guessing I need some sort of Firewall rule to allow it to go out and back in.  If we go directly to the internal IP it works fine.  Some of the users aren't grasping the internal link vs external link idea so I want to simplify it and just let everyone go to the external link.  What type of rule do I need to set up?

      I have attached the rules I thought I would need.  These are on the Firewall/NAT/Port Forward screen.  I feel like maybe I need something somewhere else.  Just not sure how to get it to loop back in and why it worked so easily on the old "dumb" router.

      Thanks for any help you can give!
      firewall_rules_gb.jpg
      firewall_rules_gb.jpg_thumb

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

        If you need to use an external DNS you have to activate NAT reflection. You can do this separately in each NAT forward rule or globally in System > Advanced > Firewall & NAT.
        In your case you will get best result with "NAT reflection + proxy".

        1 Reply Last reply Reply Quote 0
        • S
          Stewart
          last edited by

          Thanks!  I knew there had to be something simple like that but didn't realize it was in the Rule.  That was it.

          1 Reply Last reply Reply Quote 0
          • JKnottJ
            JKnott
            last edited by

            Is there any reason you're not using the built in pfSense DNS?  You can easily configure hosts in it, with the local address.  You can even enable this in the DHCP server.  This is what I do for IPv4.

            PfSense running on Qotom mini PC
            i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
            UniFi AC-Lite access point

            I haven't lost my mind. It's around here...somewhere...

            1 Reply Last reply Reply Quote 0
            • johnpozJ
              johnpoz LAYER 8 Global Moderator
              last edited by

              "we get a DNS rebind attack page."

              So your public dns is returning a rfc1918 address?  That is a borked config right there.

              Why not just setup a host override for your internal uses so that www.address.com resolve to its rfc1918 address for them.  Then public have that resolve to your public IP and setup your forwards so it can be accessed externally if you need/want that.

              An intelligent man is sometimes forced to be drunk to spend time with his fools
              If you get confused: Listen to the Music Play
              Please don't Chat/PM me for help, unless mod related
              SG-4860 24.11 | Lab VMs 2.8, 24.11

              1 Reply Last reply Reply Quote 0
              • S
                Stewart
                last edited by

                @johnpoz:

                "we get a DNS rebind attack page."

                So your public dns is returning a rfc1918 address?  That is a borked config right there.

                Let's say you have a domain called www.contoso.com whose DNS points to your public IP.  You then have port 80 on the router forwarded to something on your network (web server, Security System, etc).  If you are on the same network as the web server and try to go to www.contoso.com you will get a rebind attack.  There's nothing crazy about the config.

                @johnpoz:

                Why not just setup a host override for your internal uses so that www.address.com resolve to its rfc1918 address for them.  Then public have that resolve to your public IP and setup your forwards so it can be accessed externally if you need/want that.

                For some reason pointing directly to an internal IP on the network doesn't work properly.  The web server has 2 NICs and apparently both are needed for it to work properly.  Why port forwarding in the router to one of the IPs works, however, is beyond me.  I didn't set up the web server and I'm not about to say I understand why it does what it does.

                @JKnott:

                Is there any reason you're not using the built in pfSense DNS?  You can easily configure hosts in it, with the local address.  You can even enable this in the DHCP server.  This is what I do for IPv4.

                They have a domain and so use the DC's DNS for Active Directory resolution.  The DC does look to the router for DNS as its primary lookup source.

                1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator
                  last edited by

                  Nat reflection is not a rebind issue.  But it is an issue in its own right, if you ask me its an abomination ;)

                  Why do you have forwards on your LAN interface going to your wan address?  And why are you forwarding udp, are you using QUIC?

                  Good luck..

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.8, 24.11

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