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

    Redirect Specific Domain Outbound Traffic Back to Local LAN

    Scheduled Pinned Locked Moved DHCP and DNS
    8 Posts 5 Posters 2.8k 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.
    • L
      lysol
      last edited by

      I think what I want is a DNS record to turn around the connection back locally. Essentially I have a domain that is forwarded to my home IP address. When at home, I usually connect via the local ip of the server and when away, I use the domain name. I can use the domain name at home, but I'm essentially going out to the internet and coming back to a server that's a few feet away from me. I would like pfsense to detect that I'm trying to hit my domain from my LAN and automatically redirect it to a specific server.

      Am I supposed to use the DNS Resolver or DNS Forwarder to accomplish this?

      1 Reply Last reply Reply Quote 0
      • L
        lysol
        last edited by

        I should probably add, I'm currently just using port forwarding on my pfsense box to direct incoming traffic. I am planning on setting up a reverse proxy soon to handle this along with subdividing my domain name for each web server.

        1 Reply Last reply Reply Quote 0
        • D
          doktornotor Banned
          last edited by

          @lysol:

          Am I supposed to use the DNS Resolver or DNS Forwarder to accomplish this?

          Does not matter. Set up the host overrides in either of them.

          1 Reply Last reply Reply Quote 0
          • L
            lysol
            last edited by

            @doktornotor:

            @lysol:

            Am I supposed to use the DNS Resolver or DNS Forwarder to accomplish this?

            Does not matter. Set up the host overrides in either of them.

            If I currently have the domain "domain.net" forwarded to my home IP address, would my DNS Resolver Host Override look like?

            Host -  **leave blank?
            Domain - domain.net
            IP - **address of pfsense router?

            UPDATE

            My example above worked perfectly. I redirected my own domain name back locally. I successfully tested by disabling the WAN interface and navigating to multiple Host Override domains I created. Works like a charm.

            Running a traceroute with the WAN interface enabled gave me some interesting results as it still went out to the internet to resolve the name after pfsense overrode it.

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

              "as it still went out to the internet to resolve the name after pfsense overrode it."

              Huh??  No it didn't ;)  why don't you post up your traceroute..

              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
              • jahonixJ
                jahonix
                last edited by

                @lysol:

                … as it still went out to the internet to resolve the name after pfsense overrode it.

                Only if you hit this

                by mistake.  ;)

                1 Reply Last reply Reply Quote 0
                • L
                  lysol
                  last edited by

                  @jahonix:

                  @lysol:

                  … as it still went out to the internet to resolve the name after pfsense overrode it.

                  Only if you hit this

                  by mistake.  ;)

                  I had to create 2 host overrides for it to work the way I wanted it to

                  To override domain.net:

                  Host -  **leave blank
                  Domain - domain.net
                  IP - **address of pfsense router

                  To override www.domain.net:

                  Host -  www
                  Domain - domain.net
                  IP - **address of pfsense router

                  Thanks guys. I'm able to redirect it and keep it local now.

                  1 Reply Last reply Reply Quote 0
                  • A
                    awair
                    last edited by

                    Instead of using overrides, an alternative is to add to the 'custom options' of dnsmasq (Forwarder).

                    From the dnsmasq config example:

                    
                    # Add domains which you want to force to an IP address here.
                    # The example below send any host in doubleclick.net to a local
                    # webserver.
                    #address=/doubleclick.net/127.0.0.1
                    
                    

                    Works well when there are disparate domain names that may not be part of your domain, and a blanket override is not suitable.

                    2.4.3 (amd64)
                    and given up on the SG-1000

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