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

    BIND override A record possible?

    pfSense Packages
    2
    8
    2.0k
    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.
    • J
      jtl
      last edited by

      Hi

      I'm looking on using BIND reverse policy zone to replace an IP address in a 'A' record resolved using my router (pfSense) BIND instance. The purpose of doing this, is I have a server on my network that is hosting services, and all it's incoming and outgoing traffic is tunneled through an IPSec tunnel in a datacenter close by for some DDoS resilience and avoiding ISP port blocks, etc. Anyways, said tunnel has a public IP of it's own and so I'm looking into how to use BIND reverse policy zone to replace said IP with the server's LAN IP in DNS queries, to avoid routing traffic from LAN to the server over the external tunnel, which frankly seems like a waste of bandwidth to me.

      I currently just use 1:1 NAT on the tunnels public IP and make an exception for the server, but obviously it's not an ideal solution.

      Is it possible using BIND to override any A record that resolves to a certain IP to another IP address? I'd like to avoid keeping two copies of my zone files if it all possible.

      Thanks

      pfSense 2.4.2 - virtualized with PCIe passthrough on whitebox - 150/150 FTTP

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

        This is possible with all 3 dns options on pfsense, dnsmasq (forwarder), unbound (resolver) it is simple host override.  With bind package just create your view you want and the let the view access the specific zone with your override in it.

        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.7.2, 24.11

        1 Reply Last reply Reply Quote 0
        • J
          jtl
          last edited by

          I know that.

          What I was looking to do is override an A record in any query.

          i.e if any A record queried by the server is "192.168.1.2" replace with "192.168.1.4"

          Thanks anyways.

          pfSense 2.4.2 - virtualized with PCIe passthrough on whitebox - 150/150 FTTP

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

            you can do a redirect so anything in a domain returns an IP.. Pretty sure that can be done in all 3 as well.

            So if you query bob.domain.tld you get 192.168.1.4, if you query susan.domain.tld or kevin.domain.tld etc..

            You want to only redirect and return 192.168.1.4 if what is queried resolves to 192.168.1.2?? But you don't know what is going to be queried?

            "override any A record that resolves to a certain IP to another IP address?"

            So you don't know what this FQDN A record is??

            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.7.2, 24.11

            1 Reply Last reply Reply Quote 0
            • J
              jtl
              last edited by

              So you don't know what this FQDN A record is??

              Right. But I know what the original and "spoofed" A record response should be.

              pfSense 2.4.2 - virtualized with PCIe passthrough on whitebox - 150/150 FTTP

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

                Huh?

                If you do not know what the fqdn is - how would you create a record for it to be a different IP.  If you want to create a PTR record so if say 1.2.3.4 PTR returns host.domain.tld then you can do that.  But for you to change what a FQDN returns you need to know what that is.. Or at min you need to know what the domain is..  So you could setup so anything.domain.tld returns IP 1.2.3.4.  But if you don't even know what domain it is then no you can not do what your asking.  Or if you want host.domain.tld to return its actual value and someotherhost.domain.tld something else you need to know what that someotherhost.domin.tld is..

                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.7.2, 24.11

                1 Reply Last reply Reply Quote 0
                • J
                  jtl
                  last edited by

                  Fair enough.

                  Thanks for the help.

                  I could have sworn I've seen such functionality (replace a matched returned 'A' record with another where the FQDN is unknown) in some "penetration testing" MiTM DNS server tools, but I take it that it's not possible with any "mainstream" DNS server (Unbound, BiND, etc.)

                  pfSense 2.4.2 - virtualized with PCIe passthrough on whitebox - 150/150 FTTP

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

                    Yeah what your talking about doing would be hack for sure!!

                    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.7.2, 24.11

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